Maven打包跳过test测试类

记录一下,有两种方式:

  1. 传统方式
      命令带上参数 mvn install -Dmaven.test.skip=true 即可
  2. 使用maven-surefire-plugin插件
      在pom.xml的build里添加插件如下:
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.20.1</version>
        <configuration>
            <skipTests>true</skipTests>
        </configuration>
    </plugin>
  3. properties定义,设置其值为true。
    <properties>
    	<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    	<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    	<java.version>1.8</java.version>
    	<skipTests>true</skipTests>
    </properties>