Search code examples
grailsjvmfork

Pass options to the forked JVM


I'm using Grails 2.3.5 and I need to pass an option to the forked JVM. I've tried doing this by setting the JAVA_OPTS environment variable, but that simply gets ignored by the forked JVM. How can I go about passing the forked JVM an option?

I've found this link, which is now dead: http://jira.grails.org/browse/MAVEN-177?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel but that's if you're using the Maven plugin I believe. I'm looking for the equivalent but without having to get Maven plugin involved.


Solution

  • According to: https://grails.github.io/grails2-doc/2.3.0/guide/single.html#forkedMode (near the bottom of the section) you can use jvmArgs in your grails.project.fork configuration. In BuildConfig:

    grails.project.fork = [
        // ...
        run: [maxMemory:1024, minMemory:64, debug:false, maxPerm:256, jvmArgs: '..arbitrary JVM arguments..']
        // ...
    ]