Maven Random Tips

Categories: Java

Some random Maven build-tool tips..

For transitive dependencies, where multiple versions of the same dependency are transitively required, maven takes the version that is shallowest in the “dependency:tree” output. When two are equal depth, the first one wins. But when a dependencyManagement declaration exists, then that version is used.

When a pom with direct dependencies is included as a <dependency> in another pom, those artifacts also become dependencies of the including pom - in whichever scope the includer specifies.

When such a pom is included from within <dependencyManagement> in another pom, and scope=import is specified, then any dependencyManagement declarations in the other pom become dependencyManagement declarations in the including pom.