← 返回命令列表

Linux command

mvn-dependency 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Show dependency tree

mvn dependency:tree

Analyze dependencies

mvn dependency:analyze

List dependencies

mvn dependency:list

Copy dependencies

mvn dependency:copy-dependencies

Resolve dependencies

mvn dependency:resolve

Verbose tree

mvn dependency:tree -Dverbose

Filter tree by scope

mvn dependency:tree -Dscope=[compile]

Purge local copies

mvn dependency:purge-local-repository

说明

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.

参数

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).

FAQ

What is the mvn-dependency command used for?

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.

How do I run a basic mvn-dependency example?

Run `mvn dependency:tree` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does tree do in mvn-dependency?

Display dependency tree.