To get Java warnings from build logs, enable warning options of the Java compiler.
In Maven
Enable the showWarnings and showDeprecation flags. Add the -Xlint:all
flag to get all warnings. Check the javac manual if you only want to enable specific warnings.
<plugin> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.8</source> <target>1.8</target> <encoding>UTF-8</encoding> <showDeprecation>true</showDeprecation> <showWarnings>true</showWarnings> <compilerArgs>-Xlint:all</compilerArgs> </configuration> </plugin>
In Gradle
Add the -Xlint:all
flag for the Java compiler to get all warnings. Check the javac manual if you only want to enable specific warnings.
tasks.withType(JavaCompile) { options.compilerArgs << "-Xlint:all" }
In Javac
Use the -Xlint:all
flag for the Java compiler to get all warnings. Check the javac manual if you only want to enable specific warnings.