其他分享
首页 > 其他分享> > maven忽略测试打包

maven忽略测试打包

作者:互联网

1、常见打包命令

mvn clean  package

mvn clean package -DskipTest

mvn clean package -Dmaven.test.skip=true

2、第一种方案(推荐):

     test  不执行,也不编译

    同    mvn clean package -Dmaven.test.skip=true  命令

(1)pom.xml下

<plugin>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>

(2)添加依赖

<properties>
	<java.version>1.8</java.version>
	<maven.test.skip>true</maven.test.skip>
</properties>

(3)输入打包命令即可

      mvn clean package

3、第二种方案:

     test  不执行,会编译生成class 到 target下

  (1)pom.xml下

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

    不执行test,但会编译,生成的class文件保存在target/test-classes下。

标签:忽略,package,maven,mvn,clean,test,true,打包
来源: https://www.cnblogs.com/richard713/p/16620083.html