Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to compile using -Xlint:unchecked in a Maven project?

In NetBeans 7.2, I'm having trouble finding how to compile using -Xlint:unchecked in a Maven project. Under an Ant project, you can change compiler flags by going to Project Properties -> Compiling, but Maven projects don't seem to have any such option.

Is there any way to configure the IDE to compile with such flags using Maven?

like image 234
Alexis King Avatar asked Sep 16 '12 17:09

Alexis King


People also ask

What is the Maven command to compile?

mvn compile: This command is used to compile the project's source code. mvn clean: Here, the project is cleaned to remove all previous-build files generated. mvn test: With this command, one can run project testing steps. mvn test-compile: This command is used to compile the code from the test source.

Does Maven test-compile?

Given the lifecycle phases above, this means that when the default lifecycle is used, Maven will first validate the project, then will try to compile the sources, run those against the tests, package the binaries (e.g. jar), run integration tests against that package, verify the integration tests, install the verified ...


1 Answers

I guess you can set compiler arguments in your pom.xml. Please refer this http://maven.apache.org/plugins/maven-compiler-plugin/examples/pass-compiler-arguments.html

 <compilerArgument>-Xlint:unchecked</compilerArgument> 
like image 87
Nishant Avatar answered Sep 21 '22 00:09

Nishant