LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

mvn-dependency

goals manage Maven dependencies

TLDR

Show dependency tree
$ mvn dependency:tree
copy
Analyze dependencies
$ mvn dependency:analyze
copy
List dependencies
$ mvn dependency:list
copy
Copy dependencies
$ mvn dependency:copy-dependencies
copy
Resolve dependencies
$ mvn dependency:resolve
copy
Verbose tree showing conflict resolution
$ mvn dependency:tree -Dverbose
copy
Filter tree by scope
$ mvn dependency:tree -Dscope=[compile]
copy
Purge local copies and re-resolve
$ mvn dependency:purge-local-repository
copy

SYNOPSIS

mvn dependency:goal [options]

DESCRIPTION

The maven-dependency-plugin provides goals for analyzing, listing, copying, and resolving Maven project dependencies. The tree goal is the most commonly used, displaying the full transitive dependency tree with conflict resolution details when -Dverbose is enabled. The analyze goal identifies dependencies that are declared but unused, or used but not explicitly declared.

PARAMETERS

GOAL

Dependency plugin goal.
tree
Display dependency tree.
analyze
Analyze used/unused deps.
list
List all dependencies.
copy-dependencies
Copy deps to target.
resolve
Resolve and download all dependencies to the local repository.
purge-local-repository
Remove project dependencies from the local repository and optionally re-resolve them.
-Dscope SCOPE
Filter by dependency scope (compile, runtime, test, provided, system).
-Dincludes PATTERN
Filter output to matching artifacts (groupId:artifactId:type:version pattern, supports wildcards).
-DoutputFile FILE
Write output to a file instead of stdout (supported by tree, list, resolve).

CAVEATS

Requires a valid pom.xml. Network access is needed for initial resolution. The analyze goal cannot detect dependencies used only via reflection.

HISTORY

The Maven Dependency Plugin is part of Apache Maven, providing dependency analysis since early Maven versions.

SEE ALSO

mvn(1), mvn-deploy(1), gradle(1)

Copied to clipboard
Kai