@@ -167,28 +167,24 @@ class BuildPlugin implements Plugin<Project> {
167167 project. ext. runtimeJavaVersion = project. rootProject. ext. runtimeJavaVersion
168168 }
169169
170- /* * Finds and enforces JAVA_HOME is set */
171170 private static String findCompilerJavaHome () {
172- return findJavaHome(System . getenv(' JAVA_HOME' ), null )
173- }
174-
175- private static String findRuntimeJavaHome (final String compilerJavaHome ) {
176- return findJavaHome(System . getenv(' RUNTIME_JAVA_HOME' ), compilerJavaHome)
177- }
178-
179- private static String findJavaHome (String maybeJavaHome , String defaultJavaHome ) {
180- final String javaHome = maybeJavaHome ?: defaultJavaHome
171+ final String javaHome = System . getenv(' JAVA_HOME' )
181172 if (javaHome == null ) {
182173 if (System . getProperty(" idea.active" ) != null || System . getProperty(" eclipse.launcher" ) != null ) {
183174 // IntelliJ does not set JAVA_HOME, so we use the JDK that Gradle was run with
184- javaHome = Jvm . current(). javaHome
175+ return Jvm . current(). javaHome
185176 } else {
186- assert false
177+ throw new GradleException ( " JAVA_HOME must be set to build Elasticsearch " )
187178 }
188179 }
189180 return javaHome
190181 }
191182
183+ private static String findRuntimeJavaHome (final String compilerJavaHome ) {
184+ assert compilerJavaHome != null
185+ return System . getenv(' RUNTIME_JAVA_HOME' ) ?: compilerJavaHome
186+ }
187+
192188 /* * Finds printable java version of the given JAVA_HOME */
193189 private static String findJavaVersionDetails (Project project , String javaHome ) {
194190 String versionInfoScript = ' print(' +
0 commit comments