2

project A depends on project B.

project B has parent C.

C defines dependencyManagement section.

Does A get dependencyManagement from C? Or does C's dependencyManagment section have no impact on project A?

B.Z.
  • 418
  • 5
  • 12

1 Answers1

3

It does not inherit dependencyManagement this way. But you can import dependencyManagement of C. Normally this would be done in the parent of A. (But you can do it in A's pom.xml also)

Sample:

    <dependencyManagement>
      <dependencies>
         <dependency>
           <groupId>com.c.group</groupId>
           <artifactId>c</artifactId>
           <version>1.0</version>
           <scope>import</scope>
           <type>pom</type>
          </dependency>   
        </dependencies>
      </dependencyManagement>

This way dependency management of C will be imported.

miskender
  • 7,460
  • 1
  • 19
  • 23
  • It could be even more interesting: if project B version is inherited from a BOM imported by project A and that BOM has a parent with `dependencyManagement` that affect A's test dependency D you'll have D's version from that BOM's parent. – Konstantin Gribov Nov 19 '22 at 22:59
  • For example https://issues.apache.org/jira/browse/TIKA-3934?focusedCommentId=17636242&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-17636242 – Konstantin Gribov Nov 19 '22 at 22:59