Skip Test Maven while creating package command

Maven Skip Tests

If you are trying to run the Maven package/install command on console (Terminal) and you want to skip Maven tests, you can make use of the argument -Dmaven.test.skip=true

% mvn package -Dmaven.test.skip=true

If you want to completely skip unit tests for your project while creating the artifact you can add the below line in your pom.xml


Now you do not need to pass the -Dmaven.test.skip=true argument when you run mvn package/install command as maven.test.skip property will skip the compiling of the tests

Note: If you use -DskipTests=false, it will just skip the running tests phase, but the test will be compiled, so if you have any compilation errors, your build might fail.

Try Out Code2care Dev Tools:


Code2care is an initiative to publish and share varied knowledge in programming and technical areas gathered during day-to-day learnings and development activities.

Students and software developers can leverage this portal to find solutions to their various queries without re-inventing the wheel by referring to our easy to understand posts. Technical posts might include learnings, tutorials, trouble-shooting steps, video tutorials, code snippets, how-to, blogs, articles, etc.

🎉 We are celebrating the 10th years of Code2care! Thank you for all your support!

We strongly support Gender Equality & Diversity.