Maven打包跳过测试

时间:2021-09-11 21:31:07

运行mvn install时跳过Test

方法一:

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

方法二:

mvn install -DskipTests

或者

mvn install -Dmaven.test.skip=true

-DskipTests,不执行测试用例,但编译测试用例类生成相应的class文件至target/test-classes下。

-Dmaven.test.skip=true,不执行测试用例,也不编译测试用例类。

类似的 跳过doc生成

-Dmaven.javadoc.skip=true

跳过doc的生成:
-Dmaven.javadoc.skip=true
跳过某些module
mvn javadoc:aggregate -pl :ems.git,:ems-facade-user,:ems-facade-maindata,:ems-facade-activiti,:ems-facade-email,:ems-facade-notify,:ems-facade-bill,:ems-facade-schedule,:ems-facade-budget,:ems-facade-voucher,:ems-facade-fshared,:ems-facade-asset mvn javadoc:aggregate -Ptest -pl :ems.git,:ems-facade-user,:ems-facade-maindata,:ems-facade-activiti,:ems-facade-email,:ems-facade-notify,:ems-facade-bill,:ems-facade-schedule,:ems-facade-budget,:ems-facade-voucher,:ems-facade-fshared,:ems-facade-asset -X