Search code examples
gradlejettybootclasspath

How to set gradle JVM -X options (for gradle and compiling)?


I would like to set the -Xbootclasspath for vm launched by gradle itself. I am not sure if tests run in gradle VM or a new VM is spun up (if inside a VM, this would also get two birds stoned at the same time-pun intended). My desire is bootclasspath for compiling and bootclasspath for running tests.

My end goal is I am trying to work with this jetty alpn jar

http://www.eclipse.org/jetty/documentation/current/alpn-chapter.html#alpn-tests

It is not going so well so far though I do have eclipse compiling but can't seem to get the jetty providers to kick in.

thanks, Dean


Solution

  • To add compilation flags (for both main sources and test sources):

    tasks.withType(JavaCompile) {
        options.compilerArgs = ['-Xbootclasspath...']
    }
    

    To add test JVM flags (according to docs, tests are always run in one or more separate JVMs):

    test {
        jvmArgs = ['-Xbootclasspath...']
    }