如何在maven编译的时候跳过test
① 安装imac13如何跳过键盘鼠标检测
我们可以用两种命令来跳春贺磨过测试
mvn clean install -DskipTests
mvn clean install -Dmaven.test.skip=true
- DskipTests,不执行测试用例,但编译测试用例类生成相应的class文件至target/test-classes下
- Dmaven.test.skip=true,不执行测试用例,也不编译测试用例类
使用maven.test.skip,不但跳过单元测试的运行,也跳过测拍衡试代码的编译;
使用 mvn package -DskipTests 跳过扒斗单元测试,但是会继续编译。
② 如何让maven跳过某些指定的Test用例
测试插件详细说明http://maven.apache.org/surefire/maven-surefire-plugin/和http://maven.apache.org/surefire/maven-surefire-plugin/examples/inclusion-exclusion.html
(实例):
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version>
<configuration>
<includes>
<include>**/TestMe.java</include>
<include>**/TestYou.java</include>
</includes>
<excludes>
<exclude>**/TestOne.java<脊告/exclude>
<exclude>**/TestTwo.java</exclude>
</excludes>
</configuration>
</plugin>
追问:
这个是什么意思 能大概说一下吗?
他这个好像是忽略整个类啊
追答:
<includes>是包族迟含要测试的类樱穗明,<excludes> 是排除测试类,这个是执行或忽略整个指定类的测试用例,你是想忽略测试类里面的某一个测试方法?
③ 如何让maven跳过某些指定的Test用例
<蠢斗颤局properties>
<maven.test.skip>true</maven.test.skip>
<maven.test.failure.ignore>true</maven.test.failure.ignore>
</properties>
<plugin>
<groupId>org.apache.maven.plugins</groupId>带洞磨
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>${maven.test.skip}</skip>
<testFailureIgnore>${maven.test.failure.ignore}</testFailureIgnore>
</configuration>
</plugin>
④ maven 打包不包含test路径
1.先查看是否配置好了 maven环境 变量(测试版本为win7)
检测如下
启动cmd 运行 mvn -v 出现如图 所示 则表示环境贺答蚂配置完成
2.如果没禅埋有配置好 ,则需要重新配置下 打开环境举脊变量,如图所示
3.增加 MAVEN_HOME ,找到 你所在的 maven的路径 填写 ,如果所示
4.在path中 增加 maven 路径 ,如图所示
6.以上配置好 环境变量以后 ,进入你的项目 根目录 然后运行
mvn clean install -Dmaven.test.skip=true
⑤ 如何让maven跳过某些指定的Test用例
忽戚悄略迟仔备单元测试失败码毁: $ mvn test -Dmaven.test.failure.ignore=true 跳过单元测试: mvn install -Dmaven.test.skip=true
⑥ 如何让idea在maven install时跳过test 模块
解决方案1、在pom.xml文件中加入maven-resources-plugin配置org.apache.maven.pluginsmaven-resources-plugin2.4.32、在命令行下运行mvninstall,如果执行正确应该洞基会在{user.home}\.m2\repository\org\apache\maven\plugins\maven-resources-plugin\下看到maven-resources-plugin-2.4.3.jar文件3、刷新工程(谨颤搭右键工祥拿程选择刷新项)4、刷新maven配置,右键工程节点,选择Maven4MyEclipse-UpdateProjectConfiguration
⑦ 在eclipse中maven项目编译时怎样不跳过测试项目test resources也不给拷贝...
1)命令行插件配置
用户可以在Maven命令中使用-D参数,并伴随一个参数键=参数值的形式,来配置插件的参数。
如:mvn install -Dmaven.test.skip = true
2)Eclipse中执行 install -Dmaven.test.skip = true,
⑧ 如何让maven跳过某些指定的Test用例
测试插件详细说明http://maven.apache.org/surefire/maven-surefire-plugin/和http://maven.apache.org/surefire/maven-surefire-plugin/examples/inclusion-exclusion.html
(实例):
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin<雀蔽/artifactId>
<version>2.17</version>
<configuration>
<includes>
<include>**/TestMe.java</include>
<include>**/TestYou.java</include>
</includes>
<excludes>
<exclude>指卜**/TestOne.java</exclude>
<exclude>**/TestTwo.java</exclude>
</excludes>
</configuration>唯岁穗
</plugin>
⑨ 怎样在Maven执行install时不执行集成测试啊,求大神指教
Maven 提供了跳过单元测试的能力,信橡只需要使用 Surefire 插件的 skip 参数。 在命令行,只要简单的给闹行任何目标添加 maven.test.skip 属性就能跳过滑弯旁测试:
mvn clean install -Dmaven.test.skip=true