Am 08/23/16 um 21:27 schrieb David Hoffer: > I have some questions regarding how importing a pom type dependency in my > dependencyManagement section really works (e.g. BOM dependency). At a > basic level I understand it will effectively add all its dependencies > defined in its dependencyManagement section to my dependencyManagement > section.
Not all. Only the dependencies not already declared in your effective dependency management. Implemented in class 'org.apache.maven.model.composition.DefaultDependencyManagementImporter' <https://git-wip-us.apache.org/repos/asf?p=maven.git;a=blob;f=maven-model-builder/src/main/java/org/apache/maven/model/composition/DefaultDependencyManagementImporter.java;h=c3a0201b34be6402333f90ed4b807ec62e9ff898;hb=HEAD> based on method 'getManagementKey' of class 'org.apache.maven.model.Dependency' <https://git-wip-us.apache.org/repos/asf?p=maven.git;a=blob;f=maven-model/src/main/mdo/maven.mdo;h=8abf29ed89d256e5dbf889f7e813c1d5bf79844e;hb=629fd749e59a679809c86eb26d554520e4de3a78#l1456>. > > However the imported pom uses variables for all the versions and defines > them in its pom. Now if I want to use a different version and also have > the version variable (same variable name) set in my pom, which version will > be used? Maven imports the effective dependency management of the BOM (after inheritance, interpolation, etc.). Consider the BOM a standalone project without any relationship to the importing POM. > > What about order of the BOM import? Does the order of the BOM import > matter with respect to other non imported dependencyManagement > dependencies? If my POM has the same dependency of the imported one which > one will be used? Lets say in one case I'm using a property variable to > specify the version and also if I use a literal version. > Effective dependencies of the POM override what gets imported. See above. When using multiple BOM imports in the POM, the order of declaration of those imports matter (after inheritance, interpolation, etc.). As of Maven 3.4.0-SNAPSHOT you'll get a warning when your POM depends on this "first declaration wins" itch. Relying on the order of XML elements should be avoided. Regards, -- Christian --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org