Jay*_*Jay 7 java maven-3 maven
是否可以mvn clean test在多模块maven项目中运行maven测试build()并跳过/忽略特定模块的测试?喜欢-Dmaven.test.skip=true但是对于特定模块而不是所有模块?我不想更改为我想要跳过测试的模块<configuration>包含的万无一失<skipTests>true</skipTests>.我想知道是否可以从命令行完成此操作.我需要这个,因为在我的项目中我有很多模块,特别是一两个需要很长时间才能执行测试,所以当我只想测试几个模块时,我想跳过这些时间我不需要模块做了任何改变.
更改surefire插件的配置真的是一个问题吗?因为您只能在模块中更改一次...
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12</version>
<configuration>
<skipTests>${skip.foo.module.tests}</skipTests>
</configuration>
</plugin>
</plugins>
</build>
Run Code Online (Sandbox Code Playgroud)
...并将skipTests标记的true/false值委托给由专用配置文件激活的maven属性:
<properties>
<skip.foo.module.tests>false</skip.foo.module.tests>
</properties>
<profiles>
<profile>
<id>SKIP_FOO_MODULE_TESTS</id>
<properties>
<skip.foo.module.tests>true</skip.foo.module.tests>
</properties>
</profile>
</profiles>
Run Code Online (Sandbox Code Playgroud)
这样您就可以使用命令行在Foo模块中停用测试:
mvn clean test -P SKIP_FOO_MODULE_TESTS
| 归档时间: |
|
| 查看次数: |
6694 次 |
| 最近记录: |