简体   繁体   English

Maven surefire-plugin 执行时的版本与 pom 中的版本不同

[英]Maven surefire-plugin different version at execution than in pom

I am trying to move from JDK 8 --> JDK 11 and sure enough maven surefire-plugin is failing.我正在尝试从 JDK 8 --> JDK 11 迁移,果然 maven surefire-plugin 失败了。 So I know that I need to change it's version to 2.21.0 or above that and I already did so.所以我知道我需要将它的版本更改为 2.21.0 或更高版本,我已经这样做了。 The version is only referenced in one pom so everything should be fine and even intellIJ says that I am using version 2.22.2.该版本仅在一个 pom 中引用,因此一切都应该没问题,甚至 intellIJ 说我使用的是 2.22.2 版。 The thing is I am when I run a mvn clean install -U or mvn test, or a mvn clean then mvn compile-test and lastly a test I am still getting error referencing: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.20.1:test (default-test) on project modular-index-composer: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.20.1:test failed.: NullPointerException问题是当我运行 mvn clean install -U 或 mvn test,或 mvn clean 然后 mvn compile-test 最后一个测试时,我仍然收到错误引用: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.20.1:test (default-test) on project modular-index-composer: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.20.1:test failed.: NullPointerException

How is it even possible?这怎么可能? I am 100% sure that the project must have a version of 2.22.2.我 100% 确定该项目必须具有 2.22.2 的版本。 Is there any other way where it could be set?还有其他方法可以设置吗?

Kinda obvious/dumb solution: So the project is made up of multiple modules, and there is a "parent" module that has most of the dependencies with their versions.有点明显/愚蠢的解决方案:因此该项目由多个模块组成,并且有一个“父”模块与其版本具有大部分依赖关系。 I changed the sunfire version in this modules pom, and nothing seemed to be changing.我更改了此模块 pom 中的 sunfire 版本,但似乎没有任何变化。 (Eventhough intellij showed the correct newer version for the plugin) (尽管 intellij 显示了正确的插件新版本)

So I decided to just exclude the parent pom and add the sunfire plugin with its version directly into my module.所以我决定只排除父 pom,并将 sunfire 插件及其版本直接添加到我的模块中。 And behold it worked.看吧,它奏效了。 The issue is probably something with the parent pom, my guess would be that my module is not pulling from the correct parent pom version or it mixed it up somehow.问题可能出在父 pom 上,我的猜测是我的模块没有从正确的父 pom 版本中提取,或者它以某种方式混淆了它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM