If not set JAVA_HOME then use the JDK that Gradle was run with instead (for master) (#40622)
Extending the IDE behavior to the cli
This commit is contained in:
parent
e596b33ce8
commit
74bf4b8292
|
@ -361,16 +361,8 @@ class BuildPlugin implements Plugin<Project> {
|
|||
compilerJavaHome = findJavaHome(compilerJavaProperty)
|
||||
}
|
||||
if (compilerJavaHome == null) {
|
||||
if (System.getProperty("idea.active") != null || System.getProperty("eclipse.launcher") != null) {
|
||||
// IntelliJ does not set JAVA_HOME, so we use the JDK that Gradle was run with
|
||||
return Jvm.current().javaHome
|
||||
} else {
|
||||
throw new GradleException(
|
||||
"JAVA_HOME must be set to build Elasticsearch. " +
|
||||
"Note that if the variable was just set you might have to run `./gradlew --stop` for " +
|
||||
"it to be picked up. See https://github.com/elastic/elasticsearch/issues/31399 details."
|
||||
)
|
||||
}
|
||||
// if JAVA_HOME does not set,so we use the JDK that Gradle was run with.
|
||||
return Jvm.current().javaHome
|
||||
}
|
||||
return compilerJavaHome
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue