使用eclipse 编译elasticsearch 7.6.4小结

今天花了不少时间,编译好了elasticsearch 7.6.4,简单总结如下:

  1. 需要安装jdk 13
  2. 测试代码使用了com.sun.net.httpserver.HttpExchange ,因此需要关闭限制 “Access restriction on class due to restriction on required library rt.jar”,执行如下动作:
    On Windows: Windows -> Preferences -> Java -> Compiler -> Errors/Warnings -> Deprecated and restricted API -> Forbidden reference (access rules): -> change to warning
    On Mac OS X/Linux: Eclipse -> Preferences -> Java -> Compiler -> Errors/Warnings -> Deprecated and restricted API -> Forbidden reference (access rules): -> change to warning
    shareimprove this answer
  3. 项目中大量循环依赖,需要执行以下动作
    Mark circular dependencies as “Warning” in Eclipse tool to avoid “A CYCLE WAS DETECTED IN THE BUILD PATH” error.
    In Eclipse go to:
    Windows -> Preferences -> Java-> Compiler -> Building -> Circular Dependencies
  4. 默认过程中测试需要很长时间,如果不等待可以在build.gradle 增加如下代码,跳过(同时也无法执行)测试
//skip Test tasks
gradle.taskGraph.whenReady {
        tasks.each { task ->
            if (task.name.contains("test"))
            {
                task.enabled = false
            }
            if (task.name.contains("integTest"))
            {
                task.enabled = false
            }
            
        }
}
  1. 还需要确认使用utf-8 编码(不关键,影响少量测试代码)
    使用eclipse 编译elasticsearch 7.6.4小结_第1张图片
  2. 最后注意编译需要下载大量第三方jar,在src生成后可以考虑手工设置一些国内镜像repository

你可能感兴趣的:(elasticsearch,java)