Recompile with -Xlint parameters


(Thiago Medeiros) #1

I’m having these warnings when building:

Note: Some input files use or override a deprecated API. 
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

I just want to know how to recompile with these parameters (-Xlint:deprecation and -Xlint:unchecked), even if it is warning I don’t want to supress it, but get the details.

Thanks in advance.

(James Justinic) #2

You need to configure your JavaCompile tasks with those extra arguments. If you want this for all JavaCompile tasks rather than just particular ones, you can do this:

tasks.withType(JavaCompile) {
    options.compilerArgs << '-Xlint:unchecked'
    options.deprecation = true

The CompileOptions on the JavaCompile tasks has a deprecation property you can configure directly and not worry about actual command line argument, but you can add both -Xlint:deprecation and -Xlint:unchecked as compilerArgs, if you want.

(Nikolay Siniakevich) #3

Awesome, it works.

Thank you.