Reputation: 186
I want to see the java code warnings when I build my project from the command line using maven.
Currently, when I use eclipse, the IDE highlights the warns for me. So I want to have that behavior when I build my project using maven.
Thanks in advance. Juan
Upvotes: 2
Views: 876
Reputation: 5318
IDE-like level of warnings cannot be achieved with javac compiler thus you have to go with a non-javac one. Below is a POM snippet:
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<compilerId>eclipse</compilerId>
<source>1.7</source>
<target>1.7</target>
<optimize>true</optimize>
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
<compilerArguments>
<org.eclipse.jdt.core.compiler.problem.fatalOptionalError>disabled</org.eclipse.jdt.core.compiler.problem.fatalOptionalError>
<org.eclipse.jdt.core.compiler.problem.forbiddenReference>ignore</org.eclipse.jdt.core.compiler.problem.forbiddenReference>
</compilerArguments>
</configuration>
<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-compiler-eclipse</artifactId>
<version>2.3</version>
</dependency>
</dependencies>
</plugin>
Upvotes: 2
Reputation: 1123
You just need to add <showWarnings>true</showWarnings>
to maven compiler plug-in in your pom.xml.
Please have a look at the maven compiler documentation here.
Upvotes: 0