maven打包跳过测试类

通常在项目中都有测试代码,打包的时候不需要执行测试类,那么我们需要怎么做呢?
使用maven打包跳过测试类运行,不需要执行测试类。

有两种方式处理

  1. 打包命令中处理,在打包命令中增加参数-Dmaven.test.skip=true
    示例:clean package -Dmaven.test.skip=true

  2. pom.xml中增加配置skipTests

    1
    2
    3
     <properties>
    <skipTests>true</skipTests>
    </properties>