无法在 Maven 中强制使用较新版本的 Surefire-plugin
我有一个 Maven 项目,我正在使用 Surefire-plugin 来运行我的测试。 以前,我没有强制使用任何版本,maven 为我选择了 2.4.3(为什么??)。
我想改用 2.7.2,它对 JUnit4 有更好的支持(尤其是参数化测试)。
因此,我修改了根父 POM,如下所示:
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.7.2</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>2.7.2</version>
</dependency>
</dependencies>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
</plugins>
</pluginManagement>
但是,在子模块中,surefire:2.4.3 不断被调用。 这是 -X 调试跟踪:
[DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-surefire-plugin:2.4.3:test'
而在父 pom 中,使用 2.7.2:
[DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-surefire-plugin:2.7.2:test'
甚至 effective-pom 显示插件的“版本”(如果未在子模块中继承):
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.4.3</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
任何帮助将不胜感激。
问候, 拉斐尔
I have a maven project and I am using the surefire-plugin to run my tests.
Previously, I didn't force any version and maven picked up the 2.4.3 for me (why ??).
I want to use 2.7.2 instead, which has better support for JUnit4 (especially Parametrized tests).
Hence, I have modified the root parent POM like this :
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.7.2</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>2.7.2</version>
</dependency>
</dependencies>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
</plugins>
</pluginManagement>
However, in the child modules, this is surefire:2.4.3 that keeps being called.
Here is the -X debug trace :
[DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-surefire-plugin:2.4.3:test'
Whereas in the parent pom, 2.7.2 is used:
[DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-surefire-plugin:2.7.2:test'
And even the effective-pom shows that the "version" of the plugin if not inherited in child modules:
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.4.3</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
Any help would be much appreciated.
Regards,
Raphael
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论