How to Skip testing when Maven is packaged

Development record
I have a Maven project and I will clone the latest code. The Maven Package is about to be packaged, but an error is reported during the TEST phase. Confused, I decided to skip testing to package and deploy.

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test

Skip Test when running MVN Install or MVN Package
Method 1: Modify the pOM.xml file

<project>  
  [...]  
  <build>  
    <plugins>  
      <plugin>  
        <groupId>org.apache.maven.plugins</groupId>  
        <artifactId>maven-surefire-plugin</artifactId>  
        <version>2.18.1</version>  
        <configuration>  
          <skipTests>true</skipTests>  
        </configuration>  
      </plugin>  
    </plugins>  
  </build>  
  [...]  
</project> 

Method 2: Execute the command in Terminal

mvn install -DskipTests

Method 3: Execute the command in Terminal

mvn install -Dmaven.test.skip=true

Method 4: Use the Spring Boot project
The spring-boot-maven-plugin is already integrated with the maven-surefire-plugin, which automatically runs JUnit test
. You just need to add the following configuration to your pom.xml:

<properties>
 	<!-- Skip Test -->
    <skipTests>true</skipTests>
</properties>

Read More: