title: Sun JPEGImageEncoder compilation in Gradle
body: <p>I need to compile a code which uses <code>com.sun.image.codec.jpeg</code> package and its friends. I know, I know, its our company legacy code and we need to compile it as is.
  My problem is - Eclipse compile those files without problem, it just works.
  IDEA do the same - compile and works.
  The problem is Gradle - it gives me errors like </p>
  
  <pre><code>error: package com.sun.image.codec.jpeg does not exist
  </code></pre>
  
  <p>I know - add <code>-XDignore.symbol.file</code> to compilator. </p>
  
  <p>I did</p>
  
  <pre><code>compileJava.options.compilerArgs.add '-XDignore.symbol.file'
  </code></pre>
  
  <p>in my build.grade, I turned verbose mode and I see parameter gets passed correctly </p>
  
  <pre><code>20:28:16.148 [DEBUG] [org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler] Compiler arguments: -d C:\workspace\blabla -g -XDignore.symbol.file -classpath C:\workspace\blabla_lots_of_jars.jar  C:\workspace\tons_of_java_files.java
  20:28:16.153 [INFO] [org.gradle.api.internal.tasks.compile.jdk6.Jdk6JavaCompiler] Compiling with JDK Java compiler API.
  </code></pre>
  
  <p>But compilation fails. On <a href="https://stackoverflow.com/questions/13068146/how-to-overcome-package-com-sun-xml-internal-xxx-does-not-exist-when-compiling">the other question</a> I found that I should add to gradle file a line</p>
  
  <pre><code>compileJava.options.useAnt = true
  </code></pre>
  
  <p>which makes, you guessed, that everything compiles. The debug log is a bit different, but shows that also params are passed correctly</p>
  
  <pre><code>21:50:34.101 [DEBUG] [org.gradle.api.internal.project.ant.AntLoggingAdapter] [ant:javac] Compilation arguments:
  '-d'
  'C:\workspace\blabla'
  '-classpath'
  'tons_of_jars'
  '-target'
  '1.7'
  '-g'
  '-XDignore.symbol.file'
  '-source'
  '1.7'
  </code></pre>
  
  <p>But <code>useAnt</code> will be removed and its seems like a dirty hack.</p>
  
  <p>I use newest Gradle (1.8) and jdk1.7.0_25 on Win8 - but I doubt it matters</p>
  
  <p>How can I make Gradle properly compile my sources and respect my compilation parameters?</p>