maven打包时忽略测试代码

来源:互联网 发布:淘宝lol半价点券关键词 编辑:程序博客网 时间:2024/05/21 17:39

当我们想用maven打包的时候不想运行测试代码(junit),我们可以有一下方法

一、打包时带上以下命令

mvn install -DskipTests 或 mvn install -Dmaven.test.skip=true


二、使用maven提供的插件

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

三、使用变量

<properties><skipTests>true</skipTests></properties>或者<properties><maven.test.skip>true</maven.test.skip></properties>





0 0
原创粉丝点击