Plugin Documentation

This report describes goals, parameters details, requirements and sample usage of this plugin.

Goals

Goals available for this plugin:

Goal Report? Description
dependency:analyze No Analyzes the dependencies of this project and determines which are: used and declared; used and undeclared; unused and declared. This goal is intended to be used standalone, thus it always executes the test-compile phase - use the dependency:analyze-only goal instead when participating in the build lifecycle.

By default, maven-dependency-analyzer is used to perform the analysis, with limitations due to the fact that it works at bytecode level, but any analyzer can be plugged in through analyzer parameter.


See also: AnalyzeOnlyMojo
dependency:analyze-dep-mgt No This mojo looks at the dependencies after final resolution and looks for mismatches in your dependencyManagement section. This mojo is also useful for detecting projects that override the dependencyManagement directly. Set ignoreDirect to false to detect these otherwise normal conditions.
dependency:analyze-duplicate No Analyzes the <dependencies/> and <dependencyManagement/> tags in the pom.xml and determines the duplicate declared dependencies.
dependency:analyze-exclusions No Analyzes the exclusions defined on dependencies in this project and reports if any of them are unneeded.

Relevant use case is when an artifact in a later version has removed usage of a dependency, making the exclusion no longer necessary.

dependency:analyze-only No Analyzes the dependencies of this project and determines which are: used and declared; used and undeclared; unused and declared. This goal is intended to be used in the build lifecycle, thus it assumes that the test-compile phase has been executed - use the dependency:analyze goal instead when running standalone.

By default, maven-dependency-analyzer is used to perform the analysis, with limitations due to the fact that it works at bytecode level, but any analyzer can be plugged in through analyzer parameter.


See also: AnalyzeMojo
dependency:analyze-report Yes Analyzes the dependencies of this project and produces a report that summarizes which are: used and declared; used and undeclared; unused and declared.
dependency:build-classpath No This goal outputs a classpath string of dependencies from the local repository to a file or log.
dependency:collect No

Goal that collects the project dependencies from the repository. This goal requires Maven 3.0 or higher to function because it uses "requiresDependencyCollection". This means that it lists the groupId:artifactId:version information by downloading the pom files without downloading the actual artifacts such as jar files.

This is very useful when full dependency resolution might fail due to projects which haven't been built yet.

It is identical to resolve except for using the requiresDependencyCollection annotation attribute instead of requiresDependencyResolution.

dependency:copy No Goal that copies a list of artifacts from the repository to defined locations.
dependency:copy-dependencies No Goal that copies the project dependencies from the repository to a defined location.
dependency:display-ancestors No Displays all ancestor POMs of the project. This may be useful in a continuous integration system where you want to know all parent poms of the project.
dependency:get No Resolves a single artifact, eventually transitively, from the specified remote repositories. Caveat: will always check the central repository defined in the super pom. You could use a mirror entry in your settings.xml
dependency:go-offline No Goal that resolves all project dependencies, including plugins and reports and their dependencies.
dependency:help No Display help information on maven-dependency-plugin.
Call mvn dependency:help -Ddetail=true -Dgoal=<goal-name> to display parameter details.
dependency:list No Displays the list of dependencies for this project.
dependency:list-classes No Retrieves and lists all classes contained in the specified artifact from the specified remote repositories.
dependency:list-repositories No Goal that collect all project dependencies and then lists the repositories used by the build and by the transitive dependencies
dependency:properties No Goal that sets a property pointing to the artifact file for each project dependency. For each dependency (direct and transitive) a project property will be set which follows the groupId:artifactId:type:[classifier] form and contains the path to the resolved artifact.
dependency:purge-local-repository No When run on a project, remove the project dependencies from the local repository, and optionally re-resolve them. Outside of a project, remove the manually given dependencies.
dependency:resolve No Goal that resolves the project dependencies from the repository. When using this goal while running on Java 9 the module names will be visible as well.
dependency:resolve-plugins No Goal that resolves all project plugins and reports and their dependencies.
dependency:resolve-sources No Goal that resolves the project source dependencies from the repository.
dependency:sources No
Deprecated. in favor of resolve-sources goal and will be removed in a future version

Goal that resolves the project source dependencies from the repository.
dependency:tree No Displays the dependency tree for this project. Multiple formats are supported: text (by default), but also DOT, GraphML, TGF and JSON.
dependency:unpack No Goal that retrieves a list of artifacts from the repository and unpacks them in a defined location.
dependency:unpack-dependencies No Goal that unpacks the project dependencies from the repository to a defined location.

System Requirements

The following specifies the minimum requirements to run this Maven plugin:

Maven 3.6.3
JDK 1.8

System Requirements History

The following specifies the minimum requirements to run this Maven plugin for historical versions:

Plugin Version Maven JDK
from 3.7.0 to 3.8.1 3.6.3 8
from 3.4.0 to 3.6.1 3.2.5 8
3.3.0 3.1.1 8
3.2.0 3.1.1 7
from 3.1.0 to 3.1.2 3.0 7
from 3.0.0 to 3.0.2 3.0 6
from 2.9 to 2.10 2.2.1 5
from 2.3 to 2.8 2.0.9 5
2.2 2.0.3 5
from 2.0 to 2.1 2.0.3 1.4
from 2.0-alpha-1 to 2.0-alpha-4 2.0.3 -

Usage

You should specify the version in your project's plugin configuration:

<project>
  ...
  <build>
    <!-- To define the plugin version in your parent POM -->
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-dependency-plugin</artifactId>
          <version>3.8.1</version>
        </plugin>
        ...
      </plugins>
    </pluginManagement>
    <!-- To use the plugin goals in your POM or parent POM -->
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
      </plugin>
      ...
    </plugins>
  </build>
  ...
  <!-- To use the report goals in your POM or parent POM -->
  <reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <version>3.8.1</version>
      </plugin>
      ...
    </plugins>
  </reporting>
  ...
</project>

For more information, see "Guide to Configuring Plug-ins"