我有一个父 pom 定义
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<parallel>classesAndMethods</parallel>
<threadCount>4</threadCount>
</configuration>
</plugin>
</plugins>
</pluginManagement>
我有一个从 pom 继承的子项目,但没有在其插件部分声明插件。当我运行 maven 测试目标时,我仍然看到插件生效。
在父项目中定义 maven-surefire 插件时参考:http : //maven.apache.org/surefire/maven-surefire-plugin/usage.html
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
</plugin>
</plugins>
</pluginManagement>
添加配置部分会使其在每个子项目中隐式执行。
在子项目中,配置看起来像
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<parallel>classesAndMethods</parallel>
<threadCount>4</threadCount>
</configuration>
</plugin>
尽管子项目中的配置相当冗长,但它确保在所有子模块中显式添加依赖项和相同版本的插件。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句