How to pass -parameters javac flag to Java compiler via Gradle? : <p>I have a Gradle-managed multi-project setup that relies on the new Java 8 <code>-parameters</code> compiler flag. I need 2 ways of including the compiler flag:</p>

<ul>
<li>To test classes only (the main project should compile without parameter names attached).</li>
<li>To all compiled sources.</li>
</ul>

<p>I've tried this:</p>

<pre><code>  tasks.withType(JavaCompile) {
    options.compilerArgs &lt;&lt; '-parameters'
    options.fork = true
    options.forkOptions.executable = 'javac'
  }
</code></pre>

<p>...but it does not seem to be working properly.</p>
