Oct 01

Skip or Ignore Junit tests in Maven

maven junit

We all know, this is a very bad practice. Even the Surfire plugin documentation says that its use is NOT RECOMMENDED.

Nevertheless as a good developer you should know these switches. So keep them in your mind (in my case on this page), but don't keep them in your repository!

Command line

mvn -Dmaven.test.skip=true package
mvn -Dmaven.test.failure.ignore=true package

POM file

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-surefire-plugin</artifactId>
  <configuration>
    <skipTests>true</skipTests>
    <testFailureIgnore>true</testFailureIgnore>
  </configuration>
</plugin>
✱ ✱ ✱