I am trying to provide Gradle as an alternative build system on an existing project. That project makes use of sun.misc.Unsafe which leads to warnings like this one:
warning: Unsafe is internal proprietary API and may be removed in a future release
import sun.misc.Unsafe;
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.
apply plugin: 'java'
compileJava {
// I only managed to get this working when I forked
// and passed 'javac' as an executable
options.compilerArgs << '-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')
}
Eventhough this works for me at the moment, I hope that it can be made more elegant.
Here ( https://gist.github.com/3772416 ) is a more complete example with an accompanying ant script and a sample class that causes the problem.
I have tested this with both gradle 1.1 and 1.2. Here is my typical setup:
------------------------------------------------------------
Gradle 1.2
------------------------------------------------------------
Gradle build time: Wednesday, 12 September 2012 10:46:02 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-31-generic amd64
I have raised this as a question on stackoverflow ( http://stackoverflow.com/questions/12554829/passing-arguments-to-compiler-and-javadoc-in-gradle ) and was advised to try to use the following to replace my javadoc “solution”
javadoc.options.jflags "-XDignore.symbol.file"
When trying this the build failed with
Unrecognized option: -XDignore.symbol.file
Thank you for support