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.

Top Hashtags: