Menu

Showing posts with label Skipping Tests in Maven. Show all posts
Showing posts with label Skipping Tests in Maven. Show all posts

Skip Running Tests from Maven Build

There are multiple ways to skip the execution of the tests from a Maven project. So that at the time of build it doesn't compile the unit tests. Following are the steps using that you can skip the unit test compilation.

1. The first way is; while compiling or building the project using mvn install command. There are two commands that you can use on the command line to skip the tests running.

a. -DskipTests

b. -Dmaven.test.skip=true

2. Another way is to add the skipTests configuration in POM.xml file within the maven-surefire-plugin plugin. Below is the plugin code snippet for POM file.

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

Reference

  1. Skipping Tests - Maven