简体   繁体   English

org.apache.maven.plugins.enforcer.RequireUpperBoundDeps 失败并显示以下消息:

[英]org.apache.maven.plugins.enforcer.RequireUpperBoundDeps failed with message:

When I run "mvn clean install " I got those errors, what's the correct way to fix this issue?当我运行“mvn clean install”时出现这些错误,解决此问题的正确方法是什么? i tried to change the version of junit-jupiter to 5.7.0 but it cause more errors, can anyone help me with that?我试图将 junit-jupiter 的版本更改为 5.7.0 但它会导致更多错误,有人可以帮我吗?

[WARNING] Rule 1: org.apache.maven.plugins.enforcer.RequireUpperBoundDeps failed with message:
Failed while enforcing RequireUpperBoundDeps. The error(s) are [
Require upper bound dependencies error for org.junit.jupiter:junit-jupiter-api:5.5.2 paths to dependency are:
+-my-service:1.0.0-SNAPSHOT
  +-org.junit.jupiter:junit-jupiter-api:5.5.2
and
+-my-service:1.0.0-SNAPSHOT
  +-org.junit.jupiter:junit-jupiter-engine:5.5.2
    +-org.junit.jupiter:junit-jupiter-api:5.5.2
and
+-my-service:1.0.0-SNAPSHOT
  +-org.springframework.boot:spring-boot-starter-test:2.4.1
    +-org.junit.jupiter:junit-jupiter:5.7.0
      +-org.junit.jupiter:junit-jupiter-api:5.5.2 (managed) <-- org.junit.jupiter:junit-jupiter-api:5.7.0
and
+-my-service:1.0.0-SNAPSHOT
  +-org.springframework.boot:spring-boot-starter-test:2.4.1
    +-org.mockito:mockito-junit-jupiter:3.6.28
      +-org.junit.jupiter:junit-jupiter-api:5.5.2 (managed) <-- org.junit.jupiter:junit-jupiter-api:5.4.2
and
+-my-service:1.0.0-SNAPSHOT
  +-org.springframework.boot:spring-boot-starter-test:2.4.1
    +-org.junit.jupiter:junit-jupiter:5.7.0
      +-org.junit.jupiter:junit-jupiter-params:5.7.0
        +-org.junit.jupiter:junit-jupiter-api:5.5.2 (managed) <-- org.junit.jupiter:junit-jupiter-api:5.7.0
, 

Maven determines the artifact versions with nearest definition rule. Maven 确定具有最接近定义规则的工件版本。 That is, it uses the version of the closest dependency to your project in the tree of dependencies.也就是说,它使用依赖关系树中与您的项目最接近的依赖关系的版本。 You can always guarantee a version by declaring it explicitly in your project's POM.您始终可以通过在项目的 POM 中明确声明来保证版本。 Note that if two dependency versions are at the same depth in the dependency tree, the first declaration wins.请注意,如果两个依赖版本在依赖树中的深度相同,则第一个声明获胜。

Example: Shallowest one wins.示例:最浅的获胜。

Your project dependencies
 ​+-A
   ​+-B
     ​+-C
       ​+-D-2.0
 ​+-E
   ​+-D-1.0    <- This version is used for artifact D as this is "nearest".

Solution : update the version in the pom.xml to the newest version listed in the output ie 5.7.0 in your case.解决方案将 pom.xml 中的版本更新为 output 中列出的最新版本,即在您的情况下为5.7.0

You can print the dependency tree mvn dependency:tree and see where you are getting the conflicts in actual.您可以打印依赖关系树mvn dependency:tree并查看实际发生冲突的位置。

The rule seems to enforce a common upper bounds for a set of dependencies : this may be used to achieve binary compatibility (eg: to ensure that you don't use a lower version that would be incompatible with a transitive dependency you use because its version would be greater).该规则似乎为一组依赖项强制实施了一个共同的上限:这可用于实现二进制兼容性(例如:确保您不使用与您使用的传递依赖项不兼容的较低版本,因为它的版本会更大)。

[WARNING] Rule 1: org.apache.maven.plugins.enforcer.RequireUpperBoundDeps failed with message:
Failed while enforcing RequireUpperBoundDeps. The error(s) are [
Require upper bound dependencies error for org.junit.jupiter:junit-jupiter-api:5.5.2 paths to dependency are:
+-my-service:1.0.0-SNAPSHOT
  +-org.junit.jupiter:junit-jupiter-api:5.5.2
and
+-my-service:1.0.0-SNAPSHOT
  +-org.junit.jupiter:junit-jupiter-engine:5.5.2
    +-org.junit.jupiter:junit-jupiter-api:5.5.2
and
+-my-service:1.0.0-SNAPSHOT
  +-org.springframework.boot:spring-boot-starter-test:2.4.1
    +-org.junit.jupiter:junit-jupiter:5.7.0
      +-org.junit.jupiter:junit-jupiter-api:5.5.2 (managed) <-- org.junit.jupiter:junit-jupiter-api:5.7.0

spring boot is importing junit at version 5.7.0, but you have specified junit 5.5.2. spring 引导在 5.7.0 版本中导入 junit,但您已指定 junit 5.5.2。

Try to use the highest version (eg: 5.7.0).尝试使用最高版本(例如:5.7.0)。

暂无
暂无

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

相关问题 无法执行目标 org.apache.maven.plugins:maven-enforcer-plugin - Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin 无法执行 org.apache.maven.plugins:maven-enforcer-plugin:1.4.1:enforce: org/codehaus/plexus/util/StringUtils - Fail to execute org.apache.maven.plugins:maven-enforcer-plugin:1.4.1:enforce: org/codehaus/plexus/util/StringUtils 无法执行目标org.apache.maven.plugins:maven - Failed to execute goal org.apache.maven.plugins:maven 无法执行目标org.apache.maven.plugins(权限被拒绝) - Failed to execute goal org.apache.maven.plugins (permission denied) Maven:无法执行目标 org.apache.maven.plugins:maven-resources-plugin:2.7:resources - Maven:Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:2.7:resources Maven 3:无法执行目标org.apache.maven.plugins:maven-archetype-plugin:2.2:generate - Maven 3: Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.2:generate Maven 构建错误 - 无法执行目标 org.apache.maven.plugins:maven-assembly-plugin:2.5.5 - Maven build error - Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.5.5 Maven:未能执行目标 org.apache.maven.plugins:maven-compiler-plugin:3.10.1compile: - Maven: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile MAVEN 错误:“无法执行目标 org.apache.maven.plugins:maven-clean-plugin:3.2.0:clean” - MAVEN ERROR : "Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:3.2.0:clean " Maven原型:org.apache.maven.plugins:maven-surefire-plugin:2.20.1:测试失败:NullPointerException - Maven archetype: org.apache.maven.plugins:maven-surefire-plugin:2.20.1:test failed.: NullPointerException
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM