Recompile with -Xlint parameters

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.

2 Likes