Gradle 2.10 Can't suppress java 1.8 compiler warnings

I am new to gradle and trying to compiling java swing projects and getting lots of warning messages:

…\ReportManager.java:395: warning: XML11Serializer is internal proprietary API and may be removed in a future release
XMLSerializer serializer = new XML11Serializer(writer, of);

I tried many things but none worked for me. for instance:
//compileJava.options.compilerArgs << ‘-Xlint:-deprecation’
//compileJava.options.compilerArgs << ‘-Xlint:none’
//compileJava.options.compilerArgs << ‘-XDignore.symbol.file’
//compileJava.options.warnings = false
//compileJava.options.compilerArgs += ["-nowarn"]
//tasks.withType(JavaCompile) {
// options.deprecation = false
//}

//tasks.withType(JavaCompile){
// options.warnings = false
//}
//compileJava {
// options.compilerArgs << ‘-XDignore.symbol.file’
//}

I don’t know what I am doing wrong. can you help please.
thanx
-Zak

I moved this into the general help section.

That error message can be supressed with -XDignore.symbol.file, but you cannot use that flag with Gradle’s default way of invoking the compiler, as far as I know.

The underlying issue is described in How to set -XDignore.symbol.file=true on some compiles in multi-project build - #13 by Peter_Niederwieser, but it doesn’t look like anything in Gradle has changed.

The only way that seems to work would be to use a forked javac to build the project, as described at:

Well, at least I know now that it won’t work for a while. too bad. Thank you James for your reply.
-Zak

Doing the forked javac does work. I just added it to my project that had similar internal API warnings relating to the X509 sun classes:

compileJava { options.compilerArgs << '-XDignore.symbol.file' options.fork = true options.forkOptions.executable = 'javac' }

2 Likes

sweet. will try it and let you know.
thank you James
-Zak

James
yes, it worked. it suppressed the swing warning messages. thank you very much.
-Zak