Maven3 - How do I found dependency resolution? ( m

2019-05-10 10:18发布

问题:

With maven-3, it uses aether to resolve dependency.

Unfortunately, "mvn dependency:tree" use legacy (maven-2) resolution engine.

How do I find out the true dependency resolution for maven-3. I'm running into an issue where "exec:exec" creates different classpath then "dependency:tree".

In maven 3 - compatibility notes, it says I need to use "-X" and look at the log but there is no pointer what to look for.

Also, "assembly:assembly" brings in different 'jar' than when I print out classpath from "exec:exec".

回答1:

dependency:tree is the correct way to get the project dependencies. Since version 2.5 of the plugin it now resolves the tree using aether.

exec:exec runs the maven exec plugin. The classpath it generates is based on the plugin dependencies, if specified. It is relevant only for the purpose of the plugin execution and not to be taken in the context of project.

The similar explanation holds good in case of assembly:assembly. The jars that it brings in entirely depends on the plugin and assembly-descriptor configuration.



回答2:

Since version 2.5 of the Maven Dependency Plugin, dependency:tree works with Maven 3 (see the bug report, and the release notes)



标签: maven maven-3