ES gradle check error

Hi community members,

I'm trying to contribute to ES but when I run ./gradlew check to validate tests before writing any codes, I have the following error:

To honour the JVM settings for this build a new JVM will be forked. Please consider using the daemon: The Gradle Daemon - Gradle User Manual.
Daemon will be stopped at the end of the build stopping after processing

Configure project :benchmarks
=======================================
Elasticsearch Build Hamster says Hello!
=======================================
Gradle Version : 4.9
OS Info : Mac OS X 10.13.6 (x86_64)
JDK Version : Oracle Corporation 10.0.1 [Java HotSpot(TM) 64-Bit Server VM 10.0.1+10]
JAVA_HOME : /Users/AaronZhao/.sdkman/candidates/java/10.0.1-oracle
Random Testing Seed : 51938ABC0ECA7336

FAILURE: Build failed with an exception.

  • What went wrong:
    JAVA7_HOME required to run tasks:
    :modules:reindex:oldEs2Fixture
    :modules:reindex:oldEs1Fixture
    :modules:reindex:oldEs090Fixture
    JAVA8_HOME required to run tasks:
    :distribution:bwc:next-bugfix-snapshot:buildBwcVersion
    :distribution:bwc:next-minor-snapshot:buildBwcVersion
    JAVA10_HOME required to run tasks:
    :distribution:bwc:next-bugfix-snapshot:buildBwcVersion
    :distribution:bwc:next-minor-snapshot:buildBwcVersion

  • 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 54s

I'm using Intellij IDEA 2018.1

1 Like

Some of the tests require running on specific versions of Java.

For example, in the first error, we want to test reindexing from Elasticsearch v0.9, v1 and v2, but those versions of ES only ran on Java 7, so it is not possible for those tests to complete unless you have a Java 7 VM.

The build requires that you have environment variables named

  • JAVA7_HOME
  • JAVA8_HOME
  • JAVA10_HOME

that point to their respective Java installations in order to run those tests.

Our development docs ought to explain this, but don't.
Perhaps your first contribution could be a PR to add that information to the CONTRIBUTING doc.

Unfortunately, I set the env variables but they don't seem to work. :frowning:

I suspect that you haven't set them up correctly, as this is same build process that all the Elasticsearch development team uses.

Can you show more details about how you set these variables? Did you export them for child processes?

I use sdkman to manage the versions of Java

the env JAVA7_HOME points to /Users/AaronZhao/.sdkman/candidates/java/7.0.181-zulu
the env JAVA8_HOME points to /Users/AaronZhao/.sdkman/candidates/java/8.0.171-oracle
the env JAVA10_HOME points to /Users/AaronZhao/.sdkman/candidates/java/10.0.1-oracle

I exported them but a different error is thrown when running gradlew check:

Configure project :benchmarks
=======================================
Elasticsearch Build Hamster says Hello!
=======================================
Gradle Version : 4.9
OS Info : Mac OS X 10.13.6 (x86_64)
JDK Version : Oracle Corporation 10.0.1 [Java HotSpot(TM) 64-Bit Server VM 10.0.1+10]
JAVA_HOME : /Users/AaronZhao/.sdkman/candidates/java/10.0.1-oracle
Random Testing Seed : 26EF5F990E73DB57
STDOUT:
STDERR:
script engine for language js can not be found
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 '/Users/AaronZhao/Git/elasticsearch/benchmarks/build.gradle' line: 20

  • What went wrong:
    A problem occurred evaluating project ':benchmarks'.

Failed to apply plugin [id 'elasticsearch.build']
Could not determine java version from ''.

I think I remember something about this. Could you try setting your JAVA_HOME to JAVA8_HOME and running the build? I remember reading somewhere about the js scripts that we use early in the build being trouble.

No, it doesn't work either. Now it's complaining about the JDK version

Configure project :benchmarks
=======================================
Elasticsearch Build Hamster says Hello!
=======================================
Gradle Version : 4.9
OS Info : Mac OS X 10.13.6 (x86_64)
JDK Version : Oracle Corporation 1.8.0_171 [Java HotSpot(TM) 64-Bit Server VM 25.171-b11]
JAVA_HOME : /Users/AaronZhao/.sdkman/candidates/java/8.0.171-oracle
Random Testing Seed : 8B2518F798FD765C
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 '/Users/AaronZhao/Git/elasticsearch/benchmarks/build.gradle' line: 20

  • 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 [/Users/AaronZhao/.sdkman/candidates/java/8.0.171-oracle] corresponding to [1.8]

The build runs $JAVA_HOME/bin/jrunscript to find information about the the configured java versions the build will use. In your case, it seems it cannot find the javascript implementation:

script engine for language js can not be found

I'm not sure how this could happen. Have you tried a java installation not using sdkman to see if it works?

When I use official Oracle jdks, the shell does not complain about errors, Thank you!
I'm not sure if this is a bug of sdkman, but I think I need to warn the developers in the README for a doc PR.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.