How can I pass Java System Properties to the JVM when executing "run-app" in Grails 2.3.1? When running "grailsw run-app" two JVM are started. The Grails Console and the tomcat container running my Grails Application. I have tried appending them between and in front of the Grails target command. I have a feeling I will need to modify a script.
501 640 622 0 9:39AM ttys000 1:20.20 /Library/Java/Home/bin/java -server -Xmx768M -Xms64M -XX:PermSize=32m -XX:MaxPermSize=256m -Dfile.encoding=UTF-8 ... --conf /Users/hbrien/Software/grails-2.3.1/conf/groovy-starter.conf --classpath run-app
501 661 640 0 9:40AM ttys000 1:50.24 /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java -Xmx1024M -Xms1024M -XX:MaxPermSize=256m -Dgrails.fork.active=true -Dgrails.build.execution.context=/private/var/folder -Djdk.reflect.allowGetCallerClass=true -Dspringloaded=profile=grails;cacheDir=/Users/hbrien/.grails/2.3.1 org.grails.plugins.tomcat.fork.ForkedTomcatServer
I have discovered similar problem in debugging in Eclipse/GGTS. Running project without any grails.project.fork
configuration in BuildConfig doesn't fork, but debugging always fork Tomcat.
I think it's side effect of this issue: http://jira.grails.org/browse/GRAILS-9836
Strange is that this issue is marked unresolved, but pull request is merged and it is in actual code base. I wanted to pass some properties to forked Tomcat process and ended up with this ugly code in BuildConfig.groovy
:
if (!System.getProperty('grails.fork.active')) {
def forkedJvmArgs = System.getProperties()
.findAll { it.key.startsWith('PARAM') }
.collect { new String("-D${it.key}=${it.value}") }
println "Passing properties to forked process: $forkedJvmArgs"
grails.project.fork = [run: [jvmArgs: forkedJvmArgs]]
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With