mirror of https://github.com/apache/lucene.git
fail clearly on too-new JDK (#819)
Gradle will give a very confusing error, let's make it absolutely clear. Co-authored-by: Dawid Weiss <dawid.weiss@carrotsearch.com>
This commit is contained in:
parent
d6461eab0b
commit
c897aac077
|
@ -42,14 +42,22 @@ public class WrapperDownloader {
|
|||
public static void main(String[] args) {
|
||||
if (args.length != 1) {
|
||||
System.err.println("Usage: java WrapperDownloader.java <destination>");
|
||||
System.exit(1);
|
||||
System.exit(2);
|
||||
}
|
||||
|
||||
try {
|
||||
checkVersion();
|
||||
new WrapperDownloader().run(Paths.get(args[0]));
|
||||
} catch (Exception e) {
|
||||
System.err.println("ERROR: " + e.getMessage());
|
||||
System.exit(1);
|
||||
System.exit(3);
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkVersion() {
|
||||
int major = Runtime.getRuntime().version().feature();
|
||||
if (major != 17) {
|
||||
throw new IllegalStateException("java version be exactly 17, your version: " + major);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -121,9 +121,13 @@ if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
|||
fi
|
||||
|
||||
GRADLE_WRAPPER_JAR="$APP_HOME/gradle/wrapper/gradle-wrapper.jar"
|
||||
if ! "$JAVACMD" $JAVA_OPTS --source 11 "$APP_HOME/buildSrc/src/main/java/org/apache/lucene/gradle/WrapperDownloader.java" "$GRADLE_WRAPPER_JAR" ; then
|
||||
echo "\nSomething went wrong. Make sure you're using Java 11 or later."
|
||||
exit $?
|
||||
"$JAVACMD" $JAVA_OPTS --source 11 "$APP_HOME/buildSrc/src/main/java/org/apache/lucene/gradle/WrapperDownloader.java" "$GRADLE_WRAPPER_JAR"
|
||||
WRAPPER_STATUS=$?
|
||||
if [ "$WRAPPER_STATUS" -eq 1 ]; then
|
||||
echo "ERROR: Something went wrong. Make sure you're using Java 17."
|
||||
exit $WRAPPER_STATUS
|
||||
elif [ "$WRAPPER_STATUS" -ne 0 ]; then
|
||||
exit $WRAPPER_STATUS
|
||||
fi
|
||||
|
||||
CLASSPATH=$GRADLE_WRAPPER_JAR
|
||||
|
|
|
@ -94,6 +94,9 @@ IF NOT EXIST "%DIRNAME%\gradle.properties" SET GRADLE_DAEMON_CTRL=--no-daemon
|
|||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
@rem https://github.com/apache/lucene/pull/819
|
||||
echo Error: Something went wrong. Make sure you're using Java 17.
|
||||
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
|
|
Loading…
Reference in New Issue