tags: java basics maven java
Happening scene:
When packaging the project before, I made a mistake when packaging the test class, so I wanted to skip the test environment for packaging.

Method 1: Modify the pom file
<build>
<plugins>
<!--Skip tests when packaging-->
<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>

Add the above plug-ins to the pom file of your own maven project, and then install and package, and the package can be successfully packaged.
Method 2: Execute commands in Terminal
mvn install -Dmaven.test.skip=true (recommended) or mvn install -DskipTests (not recommended, too slow)

Method 3: Add the following configuration in pom.xml (only applicable to springBoot projects):
Because the spring-boot-maven-plugin plug-in has integrated the maven-surefire-plugin plug-in, it will automatically run junit test
<properties>
<!-- skip test -->
<skipTests>true</skipTests>
</properties>
Reference blog:Skip tests when maven is packaged - Programmer Sought
There are three ways to skip the test when using maven to package method one For the spring project: For springboot: Add the following information: Method three (general): Way four (general):...
Three solutions for testing test 1. Maven navigation bar operation: Cancel the life cycle, through the button of the interface! No Maven interface UI, please read this article Maven navigation bar set...
SpringBoot project, skip test during packaging, and packs the Maven plug -in configuration of the source code and documentation....
Packaged with the package maven command The default category will run the test unit tests, as shown below Packaging skip class to run test Pom modify the script, you can skip unit testing org.apache.m...
Transfer from Method 1: Directly use the method provided by IDEA The toolbar of the Maven command bar has the following pictureIcon, it says Skip Tests PressAfter the icon, as shown below, test is not...
How to skip the test when packaging Maven in IDEA When maven is packaged, the test class will be packaged and run. If the run fails, an error will be reported. The easiest way is to skip the test. Met...
1, @ pytest.mark.skip (REASON = ") - Skip execution test functions It can be introduced to a non-parameter referiority. Output results: Test_fixture2.py ss --- use case c execution --- 2, @ pytes...
By default, if any unit test fails, the Gradle build will abort. Usually, even if the unit test fails, we still need to build the project. To skip the entire unit test in the Gradle build, use this op...
Add after the packaging command Or directly add configuration in pom...
When the project was installed in the local warehouse, an Error occurred because the project lacked a certain test class and failed to pass the unit test. Finally, mvn install failed to execute. At th...