W3docs

Maven package/install without test (skip tests)

To package/install a Maven project without running the tests, you can use the maven-install-plugin and specify the skipTests property as true.

To package or install a Maven project without running the tests, you can pass the -DskipTests flag to the Maven command. This property is handled by the maven-surefire-plugin (for unit tests) and maven-failsafe-plugin (for integration tests).

Here is an example of how to install a Maven project without running the tests:


mvn install -DskipTests

You can also configure test skipping directly in your pom.xml file by configuring the maven-surefire-plugin:


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

With this configuration, you can run the install goal without specifying the -DskipTests option:


mvn install