Home / Java Patterns and Pitfalls     frequal.com

How To Enable Warnings in Maven

Summary

By default Maven doesn't show Java compiler warnings or deprecations. With a small entry in your pom.xml file you can enable them.

Copy and paste the XML below into your pom.xml file:

<project>
  <build>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <compilerArgument>-Xlint:all</compilerArgument>
          <showWarnings>true</showWarnings>
          <showDeprecation>true</showDeprecation>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>
Then you should see warnings and deprecations in your Maven output, just like compiler errors before.
Last modified on 20 May 2009 by AO

Copyright © 2016 Andrew Oliver