问题
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:
- parent pom imports
- child pom imports
- parent pom direct dependencyManagement entries
- child pom direct dependencyManagement entries
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?
回答1:
Following the ticket
issues.apache.org/jira/browse/MNG-5971
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.
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.
来源:https://stackoverflow.com/questions/42339668/dependencymanagement-imports-and-direct-entries-in-parent-poms