I'm trying to build Elasticsearch from the source. I cloned from the GitHub repo today, and I'm following the instructions under "Building from Source".
Running ./gradlew assemble
produces the following error:
...
> Configure project :benchmarks
=======================================
Elasticsearch Build Hamster says Hello!
=======================================
Gradle Version : 4.7
OS Info : Linux 4.4.0-112-generic (amd64)
JDK Version : Oracle Corporation 1.8.0_161 [Java HotSpot(TM) 64-Bit Server VM 25.161-b12]
JAVA_HOME : /usr/lib/jvm/java-8-oracle
Random Testing Seed : 5554B47DBBCF3CFB
Project evaluation failed including an error in afterEvaluate {}. Run with --stacktrace for details of the afterEvaluate {} error.
FAILURE: Build failed with an exception.
* Where:
Build file '<redacted>/elasticsearch-master/benchmarks/build.gradle' line: 31
* What went wrong:
A problem occurred evaluating project ':benchmarks'.
> Failed to apply plugin [id 'elasticsearch.build']
> the environment variable JAVA_HOME must be set to a JDK installation directory for Java 1.10 but is [/usr/lib/jvm/java-8-oracle] corresponding to [1.8]
...
Running sudo ./gradlew assemble
produces a different error:
FAILURE: Build failed with an exception.
* Where:
Build file '<redacted>/elasticsearch-master/benchmarks/build.gradle' line: 31
* What went wrong:
A problem occurred evaluating project ':benchmarks'.
> Failed to apply plugin [id 'elasticsearch.build']
> JAVA_HOME must be set to build Elasticsearch
But as far as I can tell, my JAVA_HOME
is set:
$ echo $JAVA_HOME
/usr/lib/jvm/java-8-oracle
$ sudo echo $JAVA_HOME
/usr/lib/jvm/java-8-oracle
$ ls /usr/lib/jvm/java-8-oracle
bin COPYRIGHT db include javafx-src.zip jre lib LICENSE man README.html release src.zip THIRDPARTYLICENSEREADME-JAVAFX.txt THIRDPARTYLICENSEREADME.txt
Other possibly-useful information:
$ java -version
java version "1.8.0_161"
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)
$ gradle -v
------------------------------------------------------------
Gradle 4.7
------------------------------------------------------------
Build time: 2018-04-18 09:09:12 UTC
Revision: b9a962bf70638332300e7f810689cb2febbd4a6c
Groovy: 2.4.12
Ant: Apache Ant(TM) version 1.9.9 compiled on February 2 2017
JVM: 1.8.0_161 (Oracle Corporation 25.161-b12)
OS: Linux 4.4.0-112-generic amd64
I'm running Ubuntu 16.04.
Anyone know how to fix this error (or alternatively, how I can build the latest version of Elasticsearch from the source), without upgrading to Java 10?