maven忽略测试打包

mvn clean

mvn deploy -Dmaven.test.skip=true

 

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下。

posted @ 2022-08-24 15:22  小鹏713  阅读(556)  评论(0编辑  收藏  举报