carlspring
carlspring

Reputation: 32597

Is there a Maven plugin that shows the dependency tree of a plugin?

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?

Upvotes: 5

Views: 3551

Answers (2)

Indra Uprade
Indra Uprade

Reputation: 808

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>

Upvotes: 1

A_Di-Matteo
A_Di-Matteo

Reputation: 27812

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.

Upvotes: 4

Related Questions