Is there an easier way to get the dependency tree of a Maven plugin, other than to checkout its sources and run a mvn dependency:tree against them?
2 Answers
Instead of checking out the concerned plugin' sources, you can still add it as a dependency of your project and then check its dependency tree as any other maven dependency.
A maven plugin is a jar file afterall and could be added as any other maven dependency (not really meaningful, unless in the context of maven plugin development).
For instance, we could had the maven-dependency-plugin as a dependency:
<dependency> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <version>2.10</version> <scope>test</scope> </dependency> Note the scope for purity, even though you would probably remove the dependency from your project after the required checks.
Now you can run on this project dependency:tree and check the dependencies of this plugin, narrowing down its output via the includes property is required.
2 Comments
-Dverbose=true (because some of the project's dependencies my cause the dependencies of the plugin to be replaced in the dependency tree). Not the most elegant solution, but I suppose it will do the trick.This is not the exact thing you want but little closer to that, at least it will analyze the dependencies and list out all the warnings upfront.
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <executions> <execution> <id>Dependency-Analyzer</id> <phase>package</phase> <goals> <goal>analyze-only</goal> </goals> </execution> </executions> </plugin>
pom.xml's dependencies.