gpt4 book ai didi

java - 从源代码构建elasticsearch(任务:基准:compileJava FAILED)

转载 作者:行者123 更新时间:2023-12-02 23:08:17 33 4
gpt4 key购买 nike

尝试从源代码构建Elasticsearch。
刚刚安装了OpenJAVA-11-sdk和jre。
以下是javajavacecho $PATH的输出。

rajesh@Rajesh-PC:~/elasticsearch$ ./gradlew  assemble
=======================================
Elasticsearch Build Hamster says Hello!
Gradle Version : 6.5
OS Info : Linux 4.15.0-111-generic (amd64)
JDK Version : 11 (JDK)
JAVA_HOME : /usr/lib/jvm/java-11-openjdk-amd64
Random Testing Seed : 48BEB2A1EC142E2C
In FIPS 140 mode : false
=======================================

> Task :build-tools:jar
:build-tools:jar: A valid plugin descriptor was found for elasticsearch.enforce-deprecation-use-failures.properties but the implementation class org.elasticsearch.gradle.EnforceDeprecationFailuresPlugin was not found in the jar.

> Task :benchmarks:compileJava FAILED
warning: No processor claimed any of these annotations: java.base/java.lang.SuppressWarnings,java.base/java.lang.Override
error: warnings found and -Werror specified
1 error
1 warning

> Task :modules:lang-mustache:compileJava
Note: /home/rajesh/elasticsearch/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/MustacheScriptEngine.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

FAILURE: Build failed with an exception.

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

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

* Get more help at https://help.gradle.org

BUILD FAILED in 15s
77 actionable tasks: 17 executed, 60 up-to-date

rajesh@Rajesh-PC:~/elasticsearch$ java -version
openjdk version "11.0.7" 2020-04-14
OpenJDK Runtime Environment (build 11.0.7+10-post-Ubuntu-2ubuntu218.04)
OpenJDK 64-Bit Server VM (build 11.0.7+10-post-Ubuntu-2ubuntu218.04, mixed mode, sharing)

rajesh@Rajesh-PC:~/elasticsearch$ javac -version
javac 11.0.7

rajesh@Rajesh-PC:~/elasticsearch$ echo $PATH
/usr/lib/jvm/java-11-openjdk-amd64/bin:/usr/local/cuda-9.0/bin:/home/rajesh/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin

最佳答案

在查看错误时,似乎存在编译错误,这很可能是由于JDK版本所致,因为JAVA_HOME指向JDK11。
以下是解决问题的方法:

  • 如果您从https://github.com/elastic/elasticsearch克隆了最新的Elasticsearch源代码,则为了构建Elasticsearch,需要JDK 14。但是,由于Elasticsearch支持JDK 11,因此该构建支持使用JDK 14进行编译以及在JDK 11运行时上进行测试。
  • 在安装JDK 14并设置指向JDK 14安装的Java主页的JAVA_HOME之后,再次使用此命令./gradlew :run运行Elasticsearch源代码。
  • 一旦过程完全启动,然后在另一个窗口中运行curl
  • curl -u elastic:password localhost:9200要获取详细说明,请参阅此 CONTRIBUTING.md

    关于java - 从源代码构建elasticsearch(任务:基准:compileJava FAILED),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63017715/

    33 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com