5

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?

3

2 Answers 2

4

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.

Sign up to request clarification or add additional context in comments.

2 Comments

A neat hack! Although... if you do it this way, you should also better use -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.
Also, in my example I should have used a different plugin as dependency: here you are using the dependency plugin to check dependencies of the dependency plugin, this could break the Internet
1

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> 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.