Maven package/install without test (skip tests)
Solution 1:
Run maven with
mvn package -Dmaven.test.skip
Solution 2:
Just provide the command mentioned below, which will ignore executing the test cases (but will compile the test code):
mvn package -DskipTests
Solution 3:
you can add this plugin configuration to your pom if you do not want to set command line arg:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
Solution 4:
Note that -Dmaven.test.skip prevents Maven building the test-jar artifact.
If you'd like to skip tests but create artifacts as per a normal build use:
-Dmaven.test.skip.exec
Solution 5:
If you are trying this in Windows Powershell, you will get this error:
[ERROR] Unknown lifecycle phase ".test.skip=true". You must specify a valid lifecycle phase or a goal in the format...
The reason for this is, in Powershell the "-
" has special meaning and it is causing problem with maven.
The solution is to prepend it with a backtick (`), like so..
mvn `-Dmaven.test.skip=true install
Reference: http://kuniganotas.wordpress.com/2011/08/12/invalid-task-test-skiptrue-you-must-specify-a-valid-lifecycle-phase/