Index: pom.xml IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- pom.xml (revision 975b734211885b7f53034604748ccfef08f5c8cc) +++ pom.xml (date 1590001999757) @@ -137,6 +137,14 @@ true + + org.apache.maven.plugins + maven-compiler-plugin + + 7 + 7 + + Index: src/main/java/org/spigotmc/builder/Builder.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- src/main/java/org/spigotmc/builder/Builder.java (revision 975b734211885b7f53034604748ccfef08f5c8cc) +++ src/main/java/org/spigotmc/builder/Builder.java (date 1590001989216) @@ -85,6 +85,7 @@ private static String applyPatchesShell = "sh"; // private static File msysDir; + private static String javaLocationStr; public static void main(String[] args) throws Exception { @@ -150,6 +151,7 @@ OptionSpec toCompile = parser.accepts( "compile", "Software to compile" ).withRequiredArg().ofType( Compile.class ).withValuesConvertedBy( new EnumConverter( Compile.class ) { } ).withValuesSeparatedBy( ',' ); + OptionSpec javaLocation = parser.accepts("java-location", "The location of the java installation").withRequiredArg().defaultsTo("java"); OptionSet options = parser.parse( args ); @@ -167,6 +169,7 @@ generateDocs = options.has( generateDocsFlag ); dev = options.has( devFlag ); compile = options.valuesOf( toCompile ); + javaLocationStr = options.valueOf(javaLocation); if ( options.has( skipCompileFlag ) ) { compile = Collections.singletonList( Compile.NONE ); @@ -336,9 +339,9 @@ if ( buildInfo.getJavaVersions() == null ) { buildInfo.setJavaVersions( new int[] - { - JavaVersion.JAVA_7.getVersion(), JavaVersion.JAVA_8.getVersion() - } ); + { + JavaVersion.JAVA_7.getVersion(), JavaVersion.JAVA_8.getVersion() + } ); } Preconditions.checkArgument( buildInfo.getJavaVersions().length == 2, "Expected only two Java versions, got %s", JavaVersion.printVersions( buildInfo.getJavaVersions() ) ); @@ -727,6 +730,16 @@ public static int runProcess(File workDir, String... command) throws Exception { + if ( command[0].equals( "java" ) ) + { + if (javaLocationStr.equals("java")) { + command[0] = System.getProperty( "java.home" ) + "/bin/" + command[0]; + } else + { + command[0] = javaLocationStr; + } + } + if ( msysDir != null ) { if ( "bash".equals( command[0] ) ) @@ -734,9 +747,9 @@ command[0] = "git-bash"; } String[] shim = new String[] - { - "cmd.exe", "/C" - }; + { + "cmd.exe", "/C" + }; command = ObjectArrays.concat( shim, command, String.class ); } return runProcess0( workDir, command ); @@ -747,10 +760,7 @@ Preconditions.checkArgument( workDir != null, "workDir" ); Preconditions.checkArgument( command != null && command.length > 0, "Invalid command" ); - if ( command[0].equals( "java" ) ) - { - command[0] = System.getProperty( "java.home" ) + "/bin/" + command[0]; - } + ProcessBuilder pb = new ProcessBuilder( command ); pb.directory( workDir ); @@ -938,26 +948,26 @@ try { TrustManager[] trustAllCerts = new TrustManager[] - { - new X509TrustManager() - { - @Override - public java.security.cert.X509Certificate[] getAcceptedIssuers() - { - return null; - } + { + new X509TrustManager() + { + @Override + public java.security.cert.X509Certificate[] getAcceptedIssuers() + { + return null; + } - @Override - public void checkClientTrusted(X509Certificate[] certs, String authType) - { - } + @Override + public void checkClientTrusted(X509Certificate[] certs, String authType) + { + } - @Override - public void checkServerTrusted(X509Certificate[] certs, String authType) - { - } - } - }; + @Override + public void checkServerTrusted(X509Certificate[] certs, String authType) + { + } + } + }; // Trust SSL certs SSLContext sc = SSLContext.getInstance( "SSL" ); @@ -1019,27 +1029,27 @@ public enum HashFormat { MD5 - { - @Override - public HashFunction getHash() - { - return Hashing.md5(); - } - }, SHA256 - { - @Override - public HashFunction getHash() - { - return Hashing.sha256(); - } - }, SHA512 - { - @Override - public HashFunction getHash() - { - return Hashing.sha512(); - } - }; + { + @Override + public HashFunction getHash() + { + return Hashing.md5(); + } + }, SHA256 + { + @Override + public HashFunction getHash() + { + return Hashing.sha256(); + } + }, SHA512 + { + @Override + public HashFunction getHash() + { + return Hashing.sha512(); + } + }; public abstract HashFunction getHash(); }