Gradle - compileJava - delete compilation Alerts

We use Gradle 2.1 and the java plugin. During Java compilation, various warnings occur, for example:

warning: [options] bootstrap class path not set in conjunction with -source 1.7 Note: ../SomeClass.java uses or overrides a deprecated API. 

We know what they mean, but will not correct them (do not ask, another thread :) Is there a way to avoid these messages? They worry a lot about the way out:

 :project1:compileJava warning: [options] bootstrap class path not set in conjunction with -source 1.7 Note: SomeClass.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. 1 warning :project1:processResources :project1:classes :project1:jar :project2:compileJava warning: [options] bootstrap class path not set in conjunction with -source 1.7 1 warning :project2:processResources :project2:classes :project2:jar :project2:war 

Is it impossible, for example, to redirect the stderr stream during Java compilation so that we can raise warnings? Or is there another way?

+8
java compiler-warnings warnings gradle
source share
3 answers

try the following:

 tasks.withType(JavaCompile) { options.warnings = false } 
+6
source share

Try adding:

 options.compilerArgs += '-Xlint:-deprecation' 
+2
source share

So far there has not been an answer that currently works (Gradle 4.0.1), so here's what works:

 options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" 
0
source share

All Articles