title: How to pass args to JVM which runs tests with Gradle
body: <p>I am a Gradle rookie and I am not sure whether Gradle will start the new JVM when it runs the test set.</p>
  
  <p>Like <a href="https://stackoverflow.com/questions/44776319/passing-jvm-arguments-to-gradle-test-task">Passing JVM arguments to Gradle test task</a> I want to pass some parameters to the JVM running the test set.</p>
  
  <p>I added the following lines to <a href="https://github.com/apache/groovy/blob/master/build.gradle" rel="noreferrer">build.gradle</a>:</p>
  
  <pre><code>...
  test {
      groovy {
          jvmArgs '-agentpath:/usr/lib/code_dependency_capturer.so' // add line
          srcDirs = ['src/test']
          if (!JavaVersion.current().isJava8Compatible()) {
              exclude '**/v8/*'
              exclude '**/vm8/*'
          }
      }
      resources {
          srcDirs = ['src/test-resources']
      }
  }
  ...
  </code></pre>
  
  <p>But it tells me:</p>
  
  <pre><code>A problem occurred evaluating root project 'groovy'.
  Could not find method jvmArgs() for arguments[-agentpath:/usr/lib/code_dependency_capturer.so] on source set 'test' of type org.gradle.api.internal.tasks.DefaultSourceSet. 
  </code></pre>
  
  <p>I googled this error but failed to solve it.</p>