springboot打包如何忽略Test单元测试

网友投稿 1245 2022-11-25

springboot打包如何忽略Test单元测试

springboot打包如何忽略Test单元测试

springboot打包忽略Test单元测试

在maven pom.xml中加入配置

org.apache.maven.plugins

maven-surefire-plugin

2.20.1

true

spring boot跳过maven test

在eclipse每次使用run as -> maven install, 总是运行junit test,一些test还关联数据库, 有的比较危险。怎么跳过测试skip test呢?

spring-boot- maven -plugin 插件 已经集成了maven-surefire-plugin插件

只需要在pom.xml里增加

true

这里需要注意的是maven.test.skip,跳过了一切与test相关的类, 连.clamiELnHJiss都不生成, 如果允许junit测试会发现ClassNotFound错误,

而skipTests会编译测试类,即生成.class文件,只是不运行测试类, 你可以手动运行测试类。

以前没有用spring boot的时候是这样跳过maven test的, 在pom.xml添加:

org.apache.maven.plugins

maven-surefire-plugin

2.12.4

true

参考:http://maven.apache.org/plugins-archives/maven-surefire-plugin-2.12.4/examples/skipping-test.html

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:第3章Cucumber场景与附注实例---------------Cucumber简单操作实例
下一篇:jQuery学习笔记--------(选择器、事件、语法)
相关文章

 发表评论

暂时没有评论,来抢沙发吧~