title: Passing arguments to compiler and javadoc in gradle
body: <p>I am trying to provide Gradle as an alternative build system on an existing project. That project makes use of <code>sun.misc.Unsafe</code> which leads to warnings like this one:</p>
  
  <pre><code>warning: Unsafe is internal proprietary API and may be removed in a future release
  import sun.misc.Unsafe; 
  </code></pre>
  
  <p>To suppress this warning <code>-XDignore.symbol.file</code> is passed as an argument to javac and javadoc in the current ant script.</p>
  
  <p>In order to suppress these warnings in Gradle I had to resort to what I feel are 'dirty' hacks that I am not too comfortable with.</p>
  
  <pre><code>apply plugin: 'java'
  
  compileJava {
      // I only managed to get this working when I forked 
      // and passed 'javac' as an executable
      options.compilerArgs &lt;&lt; '-XDignore.symbol.file'
      options.fork = true
      options.forkOptions.executable = 'javac'
  }
  
  
  javadoc {
      // These get ignored
      // options.addStringOption('XDignore.symbol.file', null)
      // options.addStringOption('XDignore.symbol.file')
  
      // This one fails the build - I am assuming it's trying to parse ''
      // options.addStringOption('XDignore.symbol.file')
  
      // This works, but it's an ugly hack
      options.addStringOption('XDignore.symbol.file', '-quiet')
  }
  </code></pre>
  
  <p>Surely there must be a more elegant way that I don't know to achieve this.</p>
  
  <p>Here ( <a href="https://gist.github.com/3772416">https://gist.github.com/3772416</a> ) is a more complete example with an accompanying ant script and a sample class that causes the problem.</p>
  
  <p>Thanks</p>
  
  <p>I am running Gradle 1.1</p>
  
  <pre><code>------------------------------------------------------------
  Gradle 1.1
  ------------------------------------------------------------
  
  Gradle build time: Tuesday, 31 July 2012 13:24:32 o'clock UTC
  Groovy: 1.8.6
  Ant: Apache Ant(TM) version 1.8.4 compiled on May 22 2012
  Ivy: 2.2.0
  JVM: 1.7.0_07 (Oracle Corporation 23.3-b01)
  OS: Linux 3.2.0-30-generic amd64
  </code></pre>
  
  <p>It seems that this is a reasonable worakround at the moment for suppressing these particular warnings. See - <a href="http://forums.gradle.org/gradle/topics/passing_arguments_to_compiler_and_javadoc?rfm=1">http://forums.gradle.org/gradle/topics/passing_arguments_to_compiler_and_javadoc?rfm=1</a></p>