How to skip test classes when compiling with Maven?
There are two common methods for skipping the execution of test classes when compiling a project using Maven.
- Maven
- Skip executing tests using Maven.
mvn clean install -Dmaven.test.skip=true
- The pom.xml file
- construct
- extensions
- Do not run tests.
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
</plugins>
</build>
By using one of the above methods, you can skip the execution of test classes during project compilation.