Elasticsearch编译构建

in with 0 comment

安装java14

https://www.oracle.com/java/technologies/javase/jdk14-archive-downloads.html

java11会有构建时会报编译问题


> Task :build-tools:compileJava FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':build-tools:compileJava'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':build-tools:compileJava'.
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:208)
        at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:263)

修改源代码

image.png
在Node的构造函数里面加一条日志,这样在服务节点启动时,就会打印该日志。

构建压缩包

linux

./gradlew :distribution:archives:linux-tar:assemble 

mac

./gradlew :distribution:archives:darwin-tar:assemble 

所有平台

./gradlew assemble

解压部署

压缩包位置
image.png
distributions/archives,默认是snapshot版本。

如果要去掉snapshot可以加下面参数构建

./gradlew assemble  -Dbuild.snap-shot=false

解压文件,参考es7集群启动配置进行配置,启动

 ./bin/elasticsearch

可以看见修改的内容已经生效:
image.png