Skip to content

Commit 8796fbc

Browse files
committed
Fix JVM args in wrong order. Set the same default JVM opts as grails. Add default system properties authenticator
1 parent 165e155 commit 8796fbc

File tree

4 files changed

+25
-4
lines changed

4 files changed

+25
-4
lines changed

shell/grailsw

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
##############################################################################
88

99
# Add default JVM options here. You can also use JAVA_OPTS and GRAILS_OPTS to pass JVM options to this script.
10-
DEFAULT_JVM_OPTS=""
10+
DEFAULT_JVM_OPTS='"-XX:+TieredCompilation" "-XX:TieredStopAtLevel=1" "-XX:CICompilerCount=3"'
1111

1212

1313
# Use the maximum available, or set MAX_FD != -1 to use that value.
@@ -148,4 +148,4 @@ function splitJvmOpts() {
148148
}
149149
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRAILS_OPTS
150150

151-
exec "$JAVACMD" -jar "$JAR_PATH" "${JVM_OPTS[@]}" "$@"
151+
exec "$JAVACMD" -jar "${JVM_OPTS[@]}" "$JAR_PATH" "$@"

shell/grailsw.bat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
if "%OS%"=="Windows_NT" setlocal
1010

1111
@rem Add default JVM options here. You can also use JAVA_OPTS and GRAILS_OPTS to pass JVM options to this script.
12-
set DEFAULT_JVM_OPTS=
12+
set DEFAULT_JVM_OPTS="-XX:+TieredCompilation" "-XX:TieredStopAtLevel=1" "-XX:CICompilerCount=3"
1313

1414
set DIRNAME=%~dp0
1515
if "%DIRNAME%" == "" set DIRNAME=.
@@ -71,7 +71,7 @@ set CMD_LINE_ARGS=%$
7171
set JAR_PATH=%APP_HOME%/grails-wrapper.jar
7272

7373
@rem Execute Grails
74-
"%JAVA_EXE%" -jar %JAR_PATH% %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRAILS_OPTS% %CMD_LINE_ARGS%
74+
"%JAVA_EXE%" -jar %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRAILS_OPTS% %JAR_PATH% %CMD_LINE_ARGS%
7575

7676
:end
7777
@rem End local scope for the variables with windows NT shell

starter/src/main/java/grails/init/Start.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package grails.init;
22

3+
import grails.proxy.SystemPropertiesAuthenticator;
34
import org.xml.sax.SAXException;
45

56
import javax.xml.parsers.ParserConfigurationException;
@@ -10,6 +11,7 @@
1011
import java.io.FileOutputStream;
1112
import java.io.IOException;
1213
import java.lang.reflect.Method;
14+
import java.net.Authenticator;
1315
import java.net.URL;
1416
import java.net.URLClassLoader;
1517
import java.nio.channels.Channels;
@@ -75,6 +77,8 @@ private static boolean updateJar(String version) {
7577
}
7678

7779
public static void main(String[] args) {
80+
Authenticator.setDefault(new SystemPropertiesAuthenticator());
81+
7882
try {
7983
String version = getVersion();
8084

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package grails.proxy;
2+
3+
import java.net.Authenticator;
4+
import java.net.PasswordAuthentication;
5+
6+
public class SystemPropertiesAuthenticator extends Authenticator {
7+
8+
@Override
9+
protected PasswordAuthentication getPasswordAuthentication() {
10+
if(getRequestorType() == RequestorType.PROXY) {
11+
return new PasswordAuthentication(
12+
System.getProperty("http.proxyUser", ""),
13+
System.getProperty("http.proxyPassword", "").toCharArray());
14+
}
15+
return null;
16+
}
17+
}

0 commit comments

Comments
 (0)