1

Trying build Elasticsearch from source.

Just installed OpenJAVA-11-sdk & jre.

below are java & javac & echo $PATH outputs as well.

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

1 Answer 1

3

Looking at the errors, it seems like there is a compilation error which is most probably because of the JDK version, as your JAVA_HOME is pointing to JDK 11.

Here are the ways by which you can resolve the issue :

  1. If you have cloned the latest Elasticsearch source code from https://github.com/elastic/elasticsearch, then to build Elasticsearch, JDK 14 is required. However, since Elasticsearch supports JDK 11, the build supports compiling with JDK 14 and testing on a JDK 11 runtime.

  2. After installing JDK 14, and setting JAVA_HOME pointing to Java home of JDK 14 installation, run Elasticsearch source code with this command again ./gradlew :run.

  3. Once the process is fully started, then run curl in another window like this

curl -u elastic:password localhost:9200

To get a detailed explanation refer this CONTRIBUTING.md

Sign up to request clarification or add additional context in comments.

3 Comments

@hacker315 did u get a chance to go through the answer, looking forward to get feedback from u?
Hey @hacker315 are you able to resolve your issue by installing JDK 14, and pointing your JAVA_HOME to JDK 14
@hacker315 thank u for accepting and upvoting the answer :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.