本文介绍了DependencyManagement-父poms中的导入和直接条目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的项目和我的父pom都有一个依赖项管理部分.这些部分都直接输入了Boms(即纯粹由dependecyManagement组成并被导入的pom).现在,我尝试找出评估顺序.我最好的猜测:

My project and my parent pom both have a dependency management section. These sections both have direct entries and "imports" of boms (i.e. poms that purely consist of dependecyManagement and are imported). Now I try to figure out the evaluation order. My best guess:

  1. 父项pom导入
  2. 儿童pom进口
  3. 父pom直接dependencyManagement条目
  4. 子pom直接dependencyManagement条目

这意味着后面的元素会覆盖前面的元素.这样对吗?如果是这样,我是否可以更改此行为,以使子元素始终覆盖父元素?

This means that later elements overwrite earlier elements. Is this correct? If so, can I change this behaviour so that the child elements always overwrite the parent elements?

推荐答案

关注票证

issues.apache.org/jira/browse/MNG-5971

的确,子项目中的导入不能覆盖直接管理条目.根据票证中的声明,应在Maven 3.6.0中更改此行为.

it is indeed true that direct management entries cannot be overwritten by imports in child projects. This behaviour should be altered in Maven 3.6.0, according to the statements in the ticket.

由于Maven 3.6.0的时代很遥远,因此我必须解决此问题.我可能会通过构造辅助Bom来避免在父pom中直接管理条目.

As Maven 3.6.0 is distant future, I have to work around this problem. I will probably avoid direct management entries in the parent pom by constructing an auxiliary bom.

这篇关于DependencyManagement-父poms中的导入和直接条目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-23 20:13