This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-dependency-plugin.git
The following commit(s) were added to refs/heads/master by this push:
new de92e952 Refresh the site documentation and README
de92e952 is described below
commit de92e9526b7a3b1e6afaf3b206593257ea6b6122
Author: Sylwester Lachiewicz <[email protected]>
AuthorDate: Tue Nov 17 23:37:15 2026 +0000
Refresh the site documentation and README
---
README.md | 97 ++++------
src/site/markdown/examples/copying-artifacts.md.vm | 26 +--
.../examples/copying-project-dependencies.md.vm | 2 +-
.../examples/filtering-the-dependency-tree.md | 17 +-
.../markdown/examples/managing-dependencies.md.vm | 8 +-
.../markdown/examples/render-dependencies.md.vm | 31 ++-
src/site/markdown/examples/tree-mojo.md | 179 ++++++++---------
.../markdown/examples/unpacking-artifacts.md.vm | 12 +-
.../markdown/examples/unpacking-filemapper.md.vm | 10 +-
.../examples/unpacking-project-dependencies.md.vm | 4 +-
.../examples/using-dependencies-sources.md.vm | 6 +-
src/site/markdown/faq.md | 45 +++--
src/site/markdown/index.md | 214 ++++++++++++++++-----
13 files changed, 374 insertions(+), 277 deletions(-)
diff --git a/README.md b/README.md
index 5284dc57..46ea4723 100644
--- a/README.md
+++ b/README.md
@@ -14,71 +14,52 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-Contributing to [Apache Maven Dependency
Plugin](https://maven.apache.org/plugins/maven-dependency-plugin/)
-======================
+# Apache Maven Dependency Plugin
-[][license]
-[][central]
-[](https://github.com/jvm-repo-rebuild/reproducible-central/blob/master/content/org/apache/maven/plugins/maven-dependency-plugin/README.md)
-[][build]
-[][test-results]
+[](https://www.apache.org/licenses/LICENSE-2.0)
+[](https://central.sonatype.com/artifact/org.apache.maven.plugins/maven-dependency-plugin)
+[](https://github.com/jvm-repo-rebuild/reproducible-central/blob/master/content/org/apache/maven/plugins/maven-dependency-plugin/README.md)
+[](https://github.com/apache/maven-dependency-plugin/actions/workflows/maven-verify.yml)
-You have found a bug, or you have an idea for a cool new feature? Contributing
-code is a great way to give something back to the open source community. Before
-you dig right into the code, there are a few guidelines that we need
-contributors to follow so that we can have a chance of keeping on top of
-things.
+The Maven plugin for working with a project's dependencies: it displays the
dependency tree, analyzes declared and
+used dependencies, copies and unpacks artifacts, builds class paths, resolves
artifacts without a project, and adds or
+removes dependencies in a `pom.xml`. It requires Maven 3.9.0 or later and Java
8 or later.
-Getting Started
----------------
+```shell
+mvn dependency:tree
+mvn dependency:analyze
+mvn dependency:copy-dependencies -DincludeScope=runtime
+mvn dependency:get -Dartifact=org.apache.commons:commons-collections4:4.4
+```
-+ Make sure you have a [GitHub account](https://github.com/signup/free).
-+ If you're planning to implement a new feature, it makes sense to discuss
your changes
- on the [dev list][ml-list] first.
- This way you can make sure you're not wasting your time on something that
isn't
- considered to be in Apache Maven's scope.
-+ Submit a ticket for your issue, assuming one does not already exist.
- + Clearly describe the issue, including steps to reproduce when it is a bug.
- + Make sure you fill in the earliest version that you know has the issue.
-+ Fork the repository on GitHub.
+- Documentation: <https://maven.apache.org/plugins/maven-dependency-plugin/>
+- Issues: <https://github.com/apache/maven-dependency-plugin/issues>
+- Security reports: see [SECURITY.md](SECURITY.md); never a public issue
+- Agents and contributors: see [AGENTS.md](AGENTS.md)
-Making and Submitting Changes
---------------
+## Build
-We accept Pull Requests via GitHub. The [developer mailing list][ml-list] is
the
-main channel of communication for contributors.
-There are some guidelines which will make applying PRs easier for us:
-+ Create a topic branch from where you want to base your work (this is usually
the master branch).
- Push your changes to a topic branch in your fork of the repository.
-+ Make commits of logical units.
-+ Respect the original code style: by using the same [codestyle][code-style],
- patches should only highlight the actual difference, not being disturbed by
any formatting issues:
- + Only use spaces for indentation.
- + Create minimal diffs - disable on save actions like reformat source code
or organize imports.
- If you feel the source code should be reformatted, create a separate PR
for this change.
- + Check for unnecessary whitespace with `git diff --check` before committing.
-+ Make sure you have added the necessary tests (JUnit/IT) for your changes.
-+ Run all the tests with `mvn -Prun-its verify` to assure nothing else was
accidentally broken.
-+ Submit a pull request to the repository in the Apache organization.
+Build and run the unit tests:
-If you plan to contribute on a regular basis, please consider filing a
[contributor license agreement][cla].
+```shell
+mvn verify
+```
-Additional Resources
---------------------
+Run the integration tests in `src/it` as well, all of them or one by name:
-+ [Contributing
patches](https://maven.apache.org/guides/development/guide-maven-development.html#Creating_and_submitting_a_patch)
-+ [Contributor License Agreement][cla]
-+ [General GitHub documentation](https://help.github.com/)
-+ [GitHub pull request
documentation](https://docs.github.com/en/github/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork)
-+ [Apache Maven X Account](https://x.com/ASFMavenProject)
-+ [Apache Maven Bluesky Account](https://bsky.app/profile/maven.apache.org)
-+ [Apache Maven Mastodon
Account](https://mastodon.social/deck/@[email protected])
+```shell
+mvn -Prun-its verify
+mvn -Prun-its verify -Dinvoker.test=tree-show-sizes
+```
-[central]:
https://central.sonatype.com/artifact/org.apache.maven.plugins/maven-dependency-plugin
-[license]: https://www.apache.org/licenses/LICENSE-2.0
-[ml-list]: https://maven.apache.org/mailing-lists.html
-[code-style]: https://maven.apache.org/developers/conventions/code.html
-[cla]: https://www.apache.org/licenses/#clas
-[maven-wiki]: https://cwiki.apache.org/confluence/display/MAVEN/Index
-[test-results]:
https://ci-maven.apache.org/job/Maven/job/maven-box/job/maven-dependency-plugin/job/master/lastCompletedBuild/testReport/
-[build]:
https://ci-maven.apache.org/job/Maven/job/maven-box/job/maven-dependency-plugin/job/master/
+Build the site into `target/site`:
+
+```shell
+mvn -DskipTests install site
+```
+
+## Contributing
+
+Open a pull request against `master` with a test that covers the change, and
run `mvn spotless:apply` before you
+commit. Discuss larger changes on the [developer mailing
list](https://maven.apache.org/mailing-lists.html) first.
+See the [guide to helping with
Maven](https://maven.apache.org/guides/development/guide-helping.html) for more.
diff --git a/src/site/markdown/examples/copying-artifacts.md.vm
b/src/site/markdown/examples/copying-artifacts.md.vm
index d8ecbebc..13b426e9 100644
--- a/src/site/markdown/examples/copying-artifacts.md.vm
+++ b/src/site/markdown/examples/copying-artifacts.md.vm
@@ -28,7 +28,7 @@ under the License.
# Copying specific artifacts
-In copying specific artifacts, you need to bind the `dependency:copy` mojo to
a lifecycle, configure the plugin and specify the artifacts you want to copy.
See the following example:
+To copy specific artifacts, bind the `dependency:copy` goal to a lifecycle
phase and list the artifacts to copy in its configuration:
```xml
<project>
@@ -51,9 +51,9 @@ In copying specific artifacts, you need to bind the
`dependency:copy` mojo to a
<configuration>
<artifactItems>
<artifactItem>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>3.8.1</version>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ <version>3.14.0</version>
<type>jar</type>
<overWrite>false</overWrite>
<outputDirectory>${esc.d}{project.build.directory}/alternateLocation</outputDirectory>
@@ -71,7 +71,8 @@ In copying specific artifacts, you need to bind the
`dependency:copy` mojo to a
</project>
```
-Then after executing `mvn package`, the artifact (junit) is copied to the
given alternate location.
+After `mvn package`, the artifact is copied to
`target/alternateLocation/optional-new-name.jar`. The `outputDirectory` of
+an `artifactItem` overrides the `outputDirectory` of the goal, which applies
to the items that do not set one.
Artifacts are resolved from the following sources in order:
@@ -93,10 +94,9 @@ to choose the intended graph, e.g.
[...]
<dependencies>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>3.8.1</version>
- <scope>test</scope>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ <version>3.14.0</version>
</dependency>
</dependencies>
[...]
@@ -116,8 +116,8 @@ to choose the intended graph, e.g.
<configuration>
<artifactItems>
<artifactItem>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
<overWrite>false</overWrite>
<outputDirectory>${esc.d}{project.build.directory}/alternateLocation</outputDirectory>
<destFileName>optional-new-name.jar</destFileName>
@@ -176,7 +176,7 @@ The `dependency:copy` goal can also be used to copy the
just built artifact to a
# <a id="Using_an_alternate_local_repository"></a>Using an alternate local
repository
-**dependency:copy** always downloads artifacts to default local repository
first, and then copy the artifacts to the desired locations. For large size
unique snapshot artifacts, the downloads can quickly fill up default local
repository, and therefore local disk, after many executions. To clean up the
downloaded artifacts as part the build, set _localRepositoryDirectory_'s value
to a location in your project's target directory.
+**dependency:copy** always downloads artifacts to the default local repository
first, and then copies them to the desired locations. For large size unique
snapshot artifacts, the downloads can quickly fill up default local repository,
and therefore local disk, after many executions. To clean up the downloaded
artifacts as part of the build, set `localRepositoryDirectory` to a location in
your project's target directory.
This use case also applies to **dependency:unpack** goal.
@@ -216,7 +216,7 @@ This use case also applies to **dependency:unpack** goal.
# <a id="Copying_from_the_command_line"></a>Copying from the command line
-If you intend to configure this mojo for execution on the command line using:
+If you intend to configure this goal for execution on the command line using:
```shell
mvn dependency:copy
diff --git a/src/site/markdown/examples/copying-project-dependencies.md.vm
b/src/site/markdown/examples/copying-project-dependencies.md.vm
index c9d75531..7d713a83 100644
--- a/src/site/markdown/examples/copying-project-dependencies.md.vm
+++ b/src/site/markdown/examples/copying-project-dependencies.md.vm
@@ -27,7 +27,7 @@ under the License.
# Copying project dependencies
-Project dependencies are the dependencies declared in your pom. To copy them
with their transitive dependencies, use the `dependency:copy-dependencies` mojo
and configure the plugin like the sample below:
+Project dependencies are the dependencies declared in your pom. To copy them
with their transitive dependencies, use the `dependency:copy-dependencies` goal
and configure the plugin like the sample below:
```xml
<project>
diff --git a/src/site/markdown/examples/filtering-the-dependency-tree.md
b/src/site/markdown/examples/filtering-the-dependency-tree.md
index 68e4bc41..1e666747 100644
--- a/src/site/markdown/examples/filtering-the-dependency-tree.md
+++ b/src/site/markdown/examples/filtering-the-dependency-tree.md
@@ -2,7 +2,6 @@
title: Filtering the dependency tree
author:
- Mark Hobson
-date: 2007-09-01
---
<!--
@@ -26,23 +25,23 @@ under the License.
# Filtering the dependency tree
-A project's dependency tree can be filtered to locate specific dependencies.
For example, to find out why Velocity is being used by the Maven Dependency
Plugin, we can execute the following in the project's directory:
+A project's dependency tree can be filtered to locate specific dependencies.
For example, to find out why Commons Lang
+is on the class path of a project, run the following in the project's
directory:
```shell
-mvn dependency:tree -Dincludes=velocity:velocity
+mvn dependency:tree -Dincludes=org.apache.commons:commons-lang3
```
Which outputs:
```text
-[INFO] [dependency:tree]
-[INFO]
org.apache.maven.plugins:maven-dependency-plugin:maven-plugin:2.0-alpha-5-SNAPSHOT
-[INFO] \- org.apache.maven.doxia:doxia-site-renderer:jar:1.0-alpha-8:compile
-[INFO] \- org.codehaus.plexus:plexus-velocity:jar:1.1.3:compile
-[INFO] \- velocity:velocity:jar:1.4:compile
+[INFO] org.example:app:jar:1.0
+[INFO] \- org.apache.commons:commons-text:jar:1.12.0:compile
+[INFO] \- org.apache.commons:commons-lang3:jar:3.14.0:compile
```
-Thus we can see that Velocity is being brought in by Plexus Velocity, which in
turn is being brought in by a direct dependency on Doxia Site Renderer.
+Thus we can see that Commons Lang is not declared by the project, but is
brought in by its direct dependency on
+Commons Text.
## Filter pattern syntax
diff --git a/src/site/markdown/examples/managing-dependencies.md.vm
b/src/site/markdown/examples/managing-dependencies.md.vm
index 9ee39997..1fd3cdfc 100644
--- a/src/site/markdown/examples/managing-dependencies.md.vm
+++ b/src/site/markdown/examples/managing-dependencies.md.vm
@@ -88,7 +88,13 @@ mvn dependency:add -Dgav=com.example:lib:1.0
-Dclassifier=sources
#[[### Duplicate Detection]]#
-If the dependency already exists in the POM (matching on `groupId`,
`artifactId`, `type`, and `classifier`), the goal fails with a descriptive
error directing you to remove the existing dependency first:
+If the dependency already exists in the POM (matching on `groupId`,
`artifactId`, `type`, and `classifier`), the goal fails with an error directing
you to remove the existing dependency first:
+
+```text
+[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-dependency-plugin:${project.version}:add
(default-cli) on project app: Dependency org.apache.commons:commons-lang3
already exists in pom.xml. Remove it first with dependency:remove, then re-add.
-> [Help 1]
+```
+
+To change the scope or version of an existing dependency, remove it and add it
again:
```shell
mvn dependency:remove -Dgav=org.apache.commons:commons-lang3
diff --git a/src/site/markdown/examples/render-dependencies.md.vm
b/src/site/markdown/examples/render-dependencies.md.vm
index 30528e14..1e609465 100644
--- a/src/site/markdown/examples/render-dependencies.md.vm
+++ b/src/site/markdown/examples/render-dependencies.md.vm
@@ -28,7 +28,11 @@ under the License.
# Render a Velocity template
-You can use `dependency:render-depedencies` mojo to a render a velocity
template, with the **artifacts** (dependencies) as context:
+The `dependency:render-dependencies` goal renders a
[Velocity](https://velocity.apache.org/engine/2.4/user-guide.html)
+template with the resolved dependencies of the project. The template sees the
dependencies, sorted by group ID,
+artifact ID and version, as `$artifacts`, and a
+[CollectionTool](https://velocity.apache.org/tools/3.1/apidocs/org/apache/velocity/tools/generic/CollectionTool.html)
+as `$sorter`. The following execution writes a YAML list of the jars:
```xml
<project>
@@ -41,14 +45,14 @@ You can use `dependency:render-depedencies` mojo to a
render a velocity template
<version>${project.version}</version>
<executions>
<execution>
- <id>copy</id>
+ <id>render-libs</id>
<phase>process-resources</phase>
<goals>
<goal>render-dependencies</goal>
</goals>
<configuration>
<template><![CDATA[
-deps:
+#[[deps:
jars:
#foreach($dep in $sorter.sort($artifacts, ["artifactId:asc"]))
#set($type = $dep.type)
@@ -60,7 +64,7 @@ deps:
#set($classifierSuffix = "-$dep.classifier")
#end
-
local:///opt/test/libs/$dep.artifactId-$dep.baseVersion$classifierSuffix.$type
-#end]]></template>
+#end]]#]]></template>
</configuration>
</execution>
</executions>
@@ -71,6 +75,21 @@ deps:
</project>
```
-Then after executing `mvn process-resources`, the template will be rendered.
By default it is printed in the console but you can set **outputFile** to store
it somewhere.
+After `mvn process-resources`, the build log shows the rendered template:
-The resolution uses exactly the same mechanism than for
**dependency:build-classpath** mojo.
+```text
+[INFO] deps:
+ jars:
+ - local:///opt/test/libs/commons-lang3-3.14.0.jar
+ - local:///opt/test/libs/commons-text-1.12.0.jar
+
+[INFO] Wrote file '/path/to/project/target/template'.
+```
+
+The `template` parameter takes the template inline, as above, or the path of a
template file. Without `outputFile`,
+the result is printed to the log. The `classifier` parameter, `template` by
default, also attaches the result to the
+project with the `extension` parameter as its type, `txt` by default, so that
it is installed and deployed with the
+main artifact; set `classifier` to an empty value to skip that.
+
+The goal selects the dependencies the same way as
[dependency:build-classpath](../build-classpath-mojo.html), with
+the same filter parameters.
diff --git a/src/site/markdown/examples/tree-mojo.md
b/src/site/markdown/examples/tree-mojo.md
index 79820b89..6f541a78 100644
--- a/src/site/markdown/examples/tree-mojo.md
+++ b/src/site/markdown/examples/tree-mojo.md
@@ -26,26 +26,28 @@ under the License.
# Dependency Tree Output Formats
-The `dependency:tree` goal of the Maven Dependency Plugin generates a
representation of a project's dependency tree. The `outputType` parameter
allows you to specify the output format, which can be written to a file using
the `outputFile` parameter or printed to the console. Supported formats are
`json`, `dot`, `graphml`, `tgf`, and `mermaid` (since 3.12.0). This section
describes each format, its structure, and example usage.
+The `dependency:tree` goal displays the dependency tree of a project. By
default it prints a text tree to the console.
+The `outputType` parameter selects another format: `json` (since 3.7.0),
`dot`, `graphml`, `tgf` or `mermaid` (since
+3.12.0). The `outputFile` parameter writes the result to a file instead of the
console. This page describes each
+format with its output for a small project that depends on Commons Text and
Commons IO.
## Usage
-To **generate** the dependency tree in a specific format, use the following
command:
+To write the dependency tree to a file in a specific format, run:
```shell
mvn dependency:tree -DoutputType=<format> -DoutputFile=<filename>
```
-- `format`: One of `json`, `dot`, `graphml`, `tgf`, or `mermaid`. If omitted,
the default is a text-based tree printed to the console.
-- `filename`: The file to write the output to (e.g., `dependency-tree.json`).
If omitted, the output is printed to the console.
+- `format`: one of `text` (the default), `json`, `dot`, `graphml`, `tgf` or
`mermaid`.
+- `filename`: the file to write the output to, for example
`dependency-tree.json`. If omitted, the output is printed
+ to the console.
- Example:
+For example:
- ```shell
- mvn dependency:tree -DoutputType=json -DoutputFile=dependency-tree.json
- ```
-
- **Note**: Ensure you are using Maven Dependency Plugin version 3.7.0 or
later (latest is 3.8.1 as of June 2025) to access these output formats.
+```shell
+mvn dependency:tree -DoutputType=json -DoutputFile=dependency-tree.json
+```
## Text tree style
@@ -61,25 +63,19 @@ For example, to force box-drawing characters:
mvn dependency:tree -Dtokens=extended
```
-When `tokens` is omitted, the plugin selects extended characters only for an
-interactive console whose reported encoding can represent all the branch
-characters. Compatible legacy encodings, such as CP437 and CP850, work as well
-as UTF-8. The plugin reads Maven's `maven.logging.outputCapabilities` map from
-execution-request data; it does not inspect terminal libraries or infer an
-encoding from the operating system or JVM default.
-
-Automatic selection uses ASCII for `outputFile`, Maven's `-l`/`--log-file`,
-batch mode (`-B`), pipes and shell redirection, and missing or unusable output
-metadata. Maven versions without the capability map, including unmodified
-Maven 3.6.3 and 3.9.16, also use ASCII automatically. The minimum supported
-Maven and Java versions are unchanged. Color settings do not control this
-selection; the plugin follows the reported destination and encoding.
-
-An explicit `tokens` value always takes precedence, including for files and
-batch mode. Unrecognized values retain the historical ASCII fallback.
-The `outputEncoding` parameter controls the plugin's `outputFile` encoding;
-it does not change Maven's console or `-l` log encoding. Other output formats
-are unaffected by `tokens`.
+When `tokens` is omitted, the plugin selects extended characters only for an
interactive console whose reported
+encoding can represent all the branch characters. Compatible legacy encodings,
such as CP437 and CP850, work as well
+as UTF-8. The plugin reads Maven's `maven.logging.outputCapabilities` map from
the execution request; it does not
+inspect terminal libraries or infer an encoding from the operating system or
JVM default.
+
+Automatic selection uses ASCII for `outputFile`, Maven's `-l`/`--log-file`,
batch mode (`-B`), pipes and shell
+redirection, and missing or unusable output metadata. Maven versions that do
not provide the capability map, such as
+Maven 3.9.16, always get ASCII. Color settings do not control this selection;
the plugin follows the reported
+destination and encoding.
+
+An explicit `tokens` value always takes precedence, including for files and
batch mode. An unrecognized value selects
+ASCII. The `outputEncoding` parameter controls the encoding of the
`outputFile`; it does not change Maven's console or
+`-l` log encoding. The other output formats ignore `tokens`.
## Output Formats
@@ -90,13 +86,13 @@ are unaffected by `tokens`.
**Structure**:
- **Root Node**:
- - `groupId`: The group ID of the project or dependency (e.g.,
`org.apache.maven.extensions`).
- - `artifactId`: The artifact ID (e.g., `maven-build-cache-extension`).
- - `version`: The version (e.g., `1.2.1-SNAPSHOT`).
+ - `groupId`: The group ID of the project or dependency (e.g.,
`org.example`).
+ - `artifactId`: The artifact ID (e.g., `app`).
+ - `version`: The version (e.g., `1.0`).
- `type`: The artifact type (e.g., `jar`).
- `scope`: The dependency scope (e.g., `compile`, `test`, or empty for the
project itself).
- `classifier`: The classifier, if any (e.g., empty string if none).
- - `optional`: Whether the dependency is optional (`true` or `false`).
+ - `optional`: Whether the dependency is optional, as the string `"true"`
or `"false"`.
- `children`: An array of dependency objects with the same structure,
representing transitive dependencies.
- With `-Dverbose`, every node also has `included` (the string `"true"`,
or `"false"` for a node Maven leaves out of the resolved tree), and, when they
apply, `omittedReason` (`duplicate` or `conflict`), `winnerVersion` (the
version kept instead, for `conflict`), `versionManagedFrom`, `scopeManagedFrom`
and `scopeNotUpdatedTo`. These fields are not written without `-Dverbose`.
- With `-DshowSizes` (since 3.12.0), every node that is not omitted also
has the number `totalSize`, the size in bytes of the distinct artifacts it
brings in, its own and those of its dependencies, and, when the artifact could
be resolved, the number `size`, the size in bytes of its file. The project has
only `totalSize`. These members are not written without `-DshowSizes`.
@@ -106,55 +102,44 @@ are unaffected by `tokens`.
```json
{
- "groupId": "org.apache.maven.extensions",
- "artifactId": "maven-build-cache-extension",
- "version": "1.2.1-SNAPSHOT",
+ "groupId": "org.example",
+ "artifactId": "app",
+ "version": "1.0",
"type": "jar",
"scope": "",
"classifier": "",
"optional": "false",
"children": [
{
- "groupId": "net.openhft",
- "artifactId": "zero-allocation-hashing",
- "version": "0.27ea0",
- "type": "jar",
- "scope": "compile",
- "classifier": "",
- "optional": "false"
- },
- {
- "groupId": "org.apache.maven.wagon",
- "artifactId": "wagon-webdav-jackrabbit",
- "version": "3.5.3",
+ "groupId": "org.apache.commons",
+ "artifactId": "commons-text",
+ "version": "1.12.0",
"type": "jar",
"scope": "compile",
"classifier": "",
"optional": "false",
"children": [
{
- "groupId": "org.apache.jackrabbit",
- "artifactId": "jackrabbit-webdav",
- "version": "2.14.4",
+ "groupId": "org.apache.commons",
+ "artifactId": "commons-lang3",
+ "version": "3.14.0",
"type": "jar",
"scope": "compile",
"classifier": "",
- "optional": "false",
- "children": [
- {
- "groupId": "commons-codec",
- "artifactId": "commons-codec",
- "version": "1.10",
- "type": "jar",
- "scope": "compile",
- "classifier": "",
- "optional": "false"
- }
- ]
+ "optional": "false"
}
- ]
+ ]
+ },
+ {
+ "groupId": "commons-io",
+ "artifactId": "commons-io",
+ "version": "2.16.1",
+ "type": "jar",
+ "scope": "compile",
+ "classifier": "",
+ "optional": "false"
}
- ]
+ ]
}
```
@@ -168,23 +153,22 @@ mvn dependency:tree -DoutputType=json
-DoutputFile=dependency-tree.json
# <a id="DOT_.28outputType.3Ddot.29"></a>DOT (outputType\=dot)
-**Description**: The DOT format is a plain-text graph description language
used by Graphviz. It represents the dependency tree as a directed graph
(`digraph`), with nodes for artifacts and directed edges for dependencies,
labeled with their scope (e.g., `compile`).
+**Description**: The DOT format is a plain-text graph description language
used by Graphviz. It represents the dependency tree as a directed graph
(`digraph`), with nodes for artifacts and directed edges for dependencies.
**Structure**:
-- **Graph Declaration**: Starts with `digraph
"<groupId>:<artifactId>:<type>:<version>:"`.
-- **Nodes**: Represented implicitly by their identifiers in edge definitions
(e.g.,
`"org.apache.maven.extensions:maven-build-cache-extension:jar:1.2.1-SNAPSHOT:"`).
-- **Edges**: Defined as `"source" -> "target"`, where `source` is the parent
artifact and `target` is the dependency, optionally labeled with the scope.
+- **Graph Declaration**: Starts with `digraph
"<groupId>:<artifactId>:<type>:<version>"`, the coordinates of the project.
+- **Nodes**: Represented implicitly by their identifiers in edge definitions
(e.g., `"org.apache.commons:commons-text:jar:1.12.0:compile"`).
+- **Edges**: Defined as `"source" -> "target"`, where `source` is the parent
artifact and `target` is the dependency. Dependencies are written as
`groupId:artifactId:type:version:scope`, the project without a scope.
**Example**:
```text
-digraph
"org.apache.maven.extensions:maven-build-cache-extension:jar:1.2.1-SNAPSHOT:" {
-
"org.apache.maven.extensions:maven-build-cache-extension:jar:1.2.1-SNAPSHOT:"
-> "net.openhft:zero-allocation-hashing:jar:0.27ea0:compile";
-
"org.apache.maven.extensions:maven-build-cache-extension:jar:1.2.1-SNAPSHOT:"
-> "org.apache.maven.wagon:wagon-webdav-jackrabbit:jar:3.5.3:compile";
- "org.apache.maven.wagon:wagon-webdav-jackrabbit:jar:3.5.3:compile" ->
"org.apache.jackrabbit:jackrabbit-webdav:jar:2.14.4:compile";
- "org.apache.jackrabbit:jackrabbit-webdav:jar:2.14.4:compile" ->
"commons-codec:commons-codec:jar:1.10:compile";
-}
+digraph "org.example:app:jar:1.0" {
+ "org.example:app:jar:1.0" ->
"org.apache.commons:commons-text:jar:1.12.0:compile" ;
+ "org.example:app:jar:1.0" -> "commons-io:commons-io:jar:2.16.1:compile"
;
+ "org.apache.commons:commons-text:jar:1.12.0:compile" ->
"org.apache.commons:commons-lang3:jar:3.14.0:compile" ;
+ }
```
**Usage Example**:
@@ -217,19 +201,18 @@ dot -Tpng dependency-tree.dot -o dependency-tree.png
**Example**:
```xml
-<?xml version="1.0" encoding="UTF-8"?>
-<graphml xmlns="http://graphml.graphdrawing.org/xmlns"
xmlns:y="http://www.yworks.com/xml/graphml">
+<?xml version="1.0" encoding="UTF-8"?> <graphml
xmlns="http://graphml.graphdrawing.org/xmlns"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:y="http://www.yworks.com/xml/graphml"
xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns
http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd">
<key for="node" id="d0" yfiles.type="nodegraphics"/>
<key for="edge" id="d1" yfiles.type="edgegraphics"/>
- <graph id="dependencies" edgedefault="directed">
- <node id="955994360"><data
key="d0"><y:ShapeNode><y:NodeLabel>org.apache.maven.extensions:maven-build-cache-extension:jar:1.2.1-SNAPSHOT:</y:NodeLabel></y:ShapeNode></data></node>
- <node id="2058879732"><data
key="d0"><y:ShapeNode><y:NodeLabel>net.openhft:zero-allocation-hashing:jar:0.27ea0:compile</y:NodeLabel></y:ShapeNode></data></node>
- <edge source="955994360" target="2058879732"><data
key="d1"><y:PolyLineEdge><y:EdgeLabel>compile</y:EdgeLabel></y:PolyLineEdge></data></edge>
- <node id="1889106580"><data
key="d0"><y:ShapeNode><y:NodeLabel>org.apache.maven.wagon:wagon-webdav-jackrabbit:jar:3.5.3:compile</y:NodeLabel></y:ShapeNode></data></node>
- <node id="1817415346"><data
key="d0"><y:ShapeNode><y:NodeLabel>org.apache.jackrabbit:jackrabbit-webdav:jar:2.14.4:compile</y:NodeLabel></y:ShapeNode></data></node>
- <edge source="1889106580" target="1817415346"><data
key="d1"><y:PolyLineEdge><y:EdgeLabel>compile</y:EdgeLabel></y:PolyLineEdge></data></edge>
- </graph>
-</graphml>
+<graph id="dependencies" edgedefault="directed">
+<node id="1293251731"><data
key="d0"><y:ShapeNode><y:NodeLabel>org.example:app:jar:1.0</y:NodeLabel></y:ShapeNode></data></node>
+<node id="1422271143"><data
key="d0"><y:ShapeNode><y:NodeLabel>org.apache.commons:commons-text:jar:1.12.0:compile</y:NodeLabel></y:ShapeNode></data></node>
+<node id="926188689"><data
key="d0"><y:ShapeNode><y:NodeLabel>org.apache.commons:commons-lang3:jar:3.14.0:compile</y:NodeLabel></y:ShapeNode></data></node>
+<edge source="1422271143" target="926188689"><data
key="d1"><y:PolyLineEdge><y:EdgeLabel>compile</y:EdgeLabel></y:PolyLineEdge></data></edge>
+<edge source="1293251731" target="1422271143"><data
key="d1"><y:PolyLineEdge><y:EdgeLabel>compile</y:EdgeLabel></y:PolyLineEdge></data></edge>
+<node id="1994634331"><data
key="d0"><y:ShapeNode><y:NodeLabel>commons-io:commons-io:jar:2.16.1:compile</y:NodeLabel></y:ShapeNode></data></node>
+<edge source="1293251731" target="1994634331"><data
key="d1"><y:PolyLineEdge><y:EdgeLabel>compile</y:EdgeLabel></y:PolyLineEdge></data></edge>
+</graph></graphml>
```
**Usage Example**:
@@ -255,16 +238,14 @@ mvn dependency:tree -DoutputType=graphml
-DoutputFile=dependency-tree.graphml
**Example**:
```text
-1474640235
org.apache.maven.extensions:maven-build-cache-extension:jar:1.2.1-SNAPSHOT:
-788877168 net.openhft:zero-allocation-hashing:jar:0.27ea0:compile
-1662807313 org.apache.maven.wagon:wagon-webdav-jackrabbit:jar:3.5.3:compile
-1655562261 org.apache.jackrabbit:jackrabbit-webdav:jar:2.14.4:compile
-1894638973 commons-codec:commons-codec:jar:1.10:compile
+943472307 org.example:app:jar:1.0
+548108014 org.apache.commons:commons-text:jar:1.12.0:compile
+1214032527 org.apache.commons:commons-lang3:jar:3.14.0:compile
+228756739 commons-io:commons-io:jar:2.16.1:compile
#
-1474640235 788877168 compile
-1474640235 1662807313 compile
-1662807313 1655562261 compile
-1655562261 1894638973 compile
+548108014 1214032527 compile
+943472307 548108014 compile
+943472307 228756739 compile
```
**Usage Example**:
@@ -292,10 +273,12 @@ mvn dependency:tree -DoutputType=tgf
-DoutputFile=dependency-tree.tgf
```text
graph LR
n0["org.example:app:jar:1.0"]
- n1["org.example:lib:jar:1.0:compile"]
+ n1["org.apache.commons:commons-text:jar:1.12.0:compile"]
n0 -->|compile| n1
- n2["org.example:util:jar:2.0:compile"]
- n1 -->|compile| n2
+ n2["commons-io:commons-io:jar:2.16.1:compile"]
+ n0 -->|compile| n2
+ n3["org.apache.commons:commons-lang3:jar:3.14.0:compile"]
+ n1 -->|compile| n3
```
**Usage Example**:
diff --git a/src/site/markdown/examples/unpacking-artifacts.md.vm
b/src/site/markdown/examples/unpacking-artifacts.md.vm
index eedfbfad..de140df4 100644
--- a/src/site/markdown/examples/unpacking-artifacts.md.vm
+++ b/src/site/markdown/examples/unpacking-artifacts.md.vm
@@ -31,7 +31,7 @@ This is pretty similar to the [Copying Specific
Artifacts](./copying-artifacts.h
The archive format is chosen by the artifact type, or by the file extension
when no unarchiver is registered for the type. The formats available are those
of [Plexus Archiver](https://codehaus-plexus.github.io/plexus-archiver/), such
as zip, jar, war, ear, tar, tar.gz, tar.bz2 and tar.xz, plus any unarchiver
that a plugin dependency adds.
-To unpack the copied artifacts, use the `dependency:unpack` mojo and configure
the plugin into something like the sample below:
+To unpack artifacts, use the `dependency:unpack` goal and configure the plugin
like the sample below:
```xml
<project>
@@ -52,9 +52,9 @@ To unpack the copied artifacts, use the `dependency:unpack`
mojo and configure t
<configuration>
<artifactItems>
<artifactItem>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>3.8.1</version>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ <version>3.14.0</version>
<type>jar</type>
<overWrite>false</overWrite>
<outputDirectory>${esc.d}{project.build.directory}/alternateLocation</outputDirectory>
@@ -86,9 +86,9 @@ group ID and artifact ID. Otherwise, a version may be
inferred from a transitive
plugin compares the versions selected by the compile, runtime, and test
dependency graphs. If those graphs select
different versions, set `dependencyScope` on the `artifactItem` to `compile`,
`runtime`, or `test`.
-# <a id="Unpacking_from_the_command_line"></a>Unpacking from the command line:
+# <a id="Unpacking_from_the_command_line"></a>Unpacking from the command line
-If you intend to configure this mojo for execution on the command line using:
+If you intend to configure this goal for execution on the command line using:
```shell
mvn dependency:unpack
diff --git a/src/site/markdown/examples/unpacking-filemapper.md.vm
b/src/site/markdown/examples/unpacking-filemapper.md.vm
index 8f8d890e..8a68d83f 100644
--- a/src/site/markdown/examples/unpacking-filemapper.md.vm
+++ b/src/site/markdown/examples/unpacking-filemapper.md.vm
@@ -26,7 +26,7 @@ under the License.
# Rewriting target path and file name
-When unpacking files, it is possible to rewrite each unpacked file's target
path and file name within the target folder. This is useful e. g. to add or
remove prefixes (like cutting away top level folders etc.):
+When unpacking files, it is possible to rewrite each unpacked file's target
path and file name within the target folder. This is useful, for example, to
add or remove prefixes, such as top-level folders:
```xml
<project>
@@ -69,9 +69,9 @@ When unpacking files, it is possible to rewrite each unpacked
file's target path
</project>
```
-The above example effectively cuts away the prefix `x.y/z/` of each unpacked
file's path, using a regular expression and a replacement expression. Two
tricks need to be used here: First, the regular expression uses `\Q` and `\E`
to demarcate pattern quoting, as the dot (`.`) is special character in a
reqular expression. Second, due to a restriction of Maven's POM syntax, the
replacement cannot be empty (this would skip the file). Instead a dot-slash
(`./`) replacement is used, which is e [...]
+The above example effectively cuts away the prefix `x.y/z/` of each unpacked
file's path, using a regular expression and a replacement expression. Two
tricks need to be used here: First, the regular expression uses `\Q` and `\E`
to demarcate pattern quoting, as the dot (`.`) is a special character in a
regular expression. Second, due to a restriction of Maven's POM syntax, the
replacement cannot be empty (this would skip the file). Instead a dot-slash
(`./`) replacement is used, which is [...]
-Any Plexus File Mapper (i. e. implementation of the interface
`org.codehaus.plexus.components.io.filemappers.FileMapper`) can be used, but
there are three particularly useful.
+Any Plexus File Mapper (an implementation of the interface
`org.codehaus.plexus.components.io.filemappers.FileMapper`) can be used, but
three are particularly useful.
The Regular Expression Mapper is useful to modify or cut away prefixes or
suffixes, or to rewrite file extensions:
@@ -94,7 +94,7 @@ The Prefix File Mapper is useful to add prefixes:
[...]
```
-The Flatten File Mapper removes the path completey, effectively putting all
files in the same folder:
+The Flatten File Mapper removes the path completely, effectively putting all
files in the same folder:
```xml
[...]
@@ -102,4 +102,4 @@ The Flatten File Mapper removes the path completey,
effectively putting all file
[...]
```
-When multiple file mappers are given, the list gets executed from top to
bottom. This might improve readability of the overal rewriting action compared
to using a singular (typically complex) regular expression.
+When multiple file mappers are given, the list gets executed from top to
bottom. This might improve readability of the overall rewriting action compared
to using a singular (typically complex) regular expression.
diff --git a/src/site/markdown/examples/unpacking-project-dependencies.md.vm
b/src/site/markdown/examples/unpacking-project-dependencies.md.vm
index 193f32c7..6cebeb1a 100644
--- a/src/site/markdown/examples/unpacking-project-dependencies.md.vm
+++ b/src/site/markdown/examples/unpacking-project-dependencies.md.vm
@@ -27,11 +27,11 @@ under the License.
# Unpacking project dependencies
-This is pretty similar to the [Copying direct
dependencies](./copying-project-dependencies.html) example. The difference is
that the direct dependencies are unpacked, including the transitive
dependencies.
+This is similar to the [Copying project
dependencies](./copying-project-dependencies.html) example. The difference is
that the dependencies, including the transitive ones, are unpacked.
The archive format is chosen by the artifact type, or by the file extension
when no unarchiver is registered for the type. The formats available are those
of [Plexus Archiver](https://codehaus-plexus.github.io/plexus-archiver/), such
as zip, jar, war, ear, tar, tar.gz, tar.bz2 and tar.xz, plus any unarchiver
that a plugin dependency adds.
-To unpack the artifacts, use the `dependency:unpack-dependencies` mojo and
configure the dependency plugin to something like the sample below:
+To unpack the artifacts, use the `dependency:unpack-dependencies` goal and
configure the plugin like the sample below:
```xml
<project>
diff --git a/src/site/markdown/examples/using-dependencies-sources.md.vm
b/src/site/markdown/examples/using-dependencies-sources.md.vm
index 4b3aed91..4c9e1a10 100644
--- a/src/site/markdown/examples/using-dependencies-sources.md.vm
+++ b/src/site/markdown/examples/using-dependencies-sources.md.vm
@@ -1,5 +1,5 @@
---
-title: Unpacking project dependencies
+title: Using project dependencies' sources
author:
- Carlos Sanchez
date: 2007-10-01
@@ -26,9 +26,9 @@ under the License.
# Using project dependencies' sources
-This is pretty similar to the [Copying project
dependencies](./copying-project-dependencies.html) or [Unpacking project
dependencies](./unpacking-project-dependencies.html) examples.
+This is similar to the [Copying project
dependencies](./copying-project-dependencies.html) or [Unpacking project
dependencies](./unpacking-project-dependencies.html) examples.
-Instead of using the project dependencies it uses their sources. Use the goal
`copy-dependencies` to just copy the sources jars to a directory or
`unpack-dependencies` to extract them. See the sample below:
+Instead of the project dependencies, it uses their source jars. Use the goal
`copy-dependencies` to just copy the sources jars to a directory or
`unpack-dependencies` to extract them. See the sample below:
```xml
<project>
diff --git a/src/site/markdown/faq.md b/src/site/markdown/faq.md
index 133e842b..5f495612 100644
--- a/src/site/markdown/faq.md
+++ b/src/site/markdown/faq.md
@@ -26,7 +26,7 @@ under the License.
# Frequently Asked Questions
1. [What is the difference between dependency-maven-plugin and
maven-dependency-plugin?](#plugin_name)
-2. [When executing `mvn dependency:unpack` or `dependency:copy` from the
command line, I get "One or more required plugin parameters are
invalid/missing for 'dependency:unpack'"](#cli)
+2. [When executing `mvn dependency:unpack` or `dependency:copy` from the
command line, I get "Either artifact or artifactItems is
required"](#cli)
3. [Why am I getting errors that a documented goal or parameter is
missing?](#missing)
4. [Why is Maven resolving "dependency:xxx" to the older
org.codehaus.mojo:dependency-maven-plugin?](#question)
5. [Why am I having trouble unpacking only a specific file?](#includes)
@@ -38,44 +38,41 @@ under the License.
### What is the difference between dependency-maven-plugin and
maven-dependency-plugin?
-Actually, they are the same, it's just that it was moved and renamed. The
dependency-maven-plugin is hosted at
-Mojo while maven-dependency-plugin is hosted at Apache. The recommended plugin
to use is the
+They are the same plugin. It started as
`org.codehaus.mojo:dependency-maven-plugin` and moved to Apache Maven as
+`org.apache.maven.plugins:maven-dependency-plugin`. The Codehaus version is no
longer maintained; use the
maven-dependency-plugin.
<a id="cli"></a>
-### When executing `mvn dependency:unpack` or `dependency:copy` from the
command line, I get "One or more required plugin parameters are
invalid/missing for 'dependency:unpack'"
+### When executing `mvn dependency:unpack` or `dependency:copy` from the
command line, I get "Either artifact or artifactItems is required"
-In order for this to work, you must configure the ArtifactItems as shown
-[here](examples/copying-artifacts.html#Copying_from_the_command_line). Note
that when executing a plugin from
-the command line, you must put the configuration tag outside of the executions.
+Both goals need to know which artifacts to process. For a single artifact,
pass its coordinates on the command line:
-If you haven't done this correctly, the error will look like this:
-
-```
-[0] inside the definition for plugin: 'maven-dependency-plugin', specify the
following:
+```shell
+mvn dependency:copy -Dartifact=org.apache.commons:commons-collections4:4.4
-DoutputDirectory=target/libs
```
+For several artifacts, configure the `artifactItems` as shown in
+[Copying from the command
line](examples/copying-artifacts.html#Copying_from_the_command_line). When a
goal is run
+from the command line, the `configuration` element must be outside the
`executions` element; a configuration inside
+an execution applies only to that execution.
+
<a id="missing"></a>
### Why am I getting errors that a documented goal or parameter is missing?
-The latest documents are published and may preceed the actual release. Check
to make sure the goal/parameter is
-in the most recent version. **-OR-** Maven may be resolving the older codehaus
version of the dependency plugin.
-See next question.
+The documentation can be published before the release that contains the goal
or parameter, and each goal and parameter
+page shows the version it was added in. Check that your build uses that
version or a later one, for example with
+`mvn dependency:help`, which prints the version of the plugin that Maven
resolves.
<a id="question"></a>
### Why is Maven resolving "dependency:xxx" to the older
org.codehaus.mojo:dependency-maven-plugin?
-Due to a bug in Maven in versions prior to 2.0.7
-([MNG-2926](https://issues.apache.org/jira/browse/MNG-2926)), the search order
was reversed and caused Mojo
-plugins to supercede ones with the same prefix at Apache. The metadata at Mojo
was cleaned up when the
-maven-dependency-plugin was released at Apache. If you are still experiencing
this error, chances are you have
-old metadata in your local repository or in a proxy / internal repository.
Removing
-`/org/codehaus/mojo/maven-metadata.*` from your repo/proxy will cause it to be
refreshed. Alternatively, you can
-specify the groupId explicitely in your pom (if you are using a bound goal),
or on the command line, use
-groupId:artifactId:version:mojo, ie `mvn
org.apache.maven.plugins:maven-dependency-plugin:2.5:unpack`
+The `dependency` prefix belongs to the maven-dependency-plugin, and the
current Maven versions resolve it to the Apache
+plugin. If an old plugin is still used, its metadata is probably left over in
your local repository or in a repository
+manager. Delete `org/codehaus/mojo/maven-metadata-*.xml` from there, or call
the plugin by its full coordinates, for
+example `mvn
org.apache.maven.plugins:maven-dependency-plugin:<version>:unpack`.
<a id="includes"></a>
@@ -134,4 +131,6 @@ detected. This is the case, for example, of constants,
annotations with source r
links.
If the only use of a dependency consists of such undetected constructs, the
dependency is analyzed as unused.
-Since 2.6, you can force use report with `usedDependencies` parameter.
+To count such a dependency as used, list it in the `usedDependencies`
parameter. See
+[Exclude dependencies from dependency
analysis](examples/exclude-dependencies-from-dependency-analysis.html) for
+more ways to handle these dependencies.
diff --git a/src/site/markdown/index.md b/src/site/markdown/index.md
index 8d5db8ed..1d286e69 100644
--- a/src/site/markdown/index.md
+++ b/src/site/markdown/index.md
@@ -3,7 +3,6 @@ title: Introduction
author:
- Allan Ramirez
- Brian Fox
-date: 2014-08-07
---
<!--
@@ -26,68 +25,179 @@ under the License.
-->
# Apache Maven Dependency Plugin
-The dependency plugin provides the capability to manipulate artifacts. It can
copy and/or unpack artifacts from local or remote repositories to a specified
location.
+
+The Dependency Plugin works with a project's dependencies and with artifacts
in repositories. It shows where each
+dependency comes from, reports dependencies that the code uses without
declaring them or declares without using them,
+copies or unpacks artifacts to a directory, builds class paths, and edits the
dependencies of a `pom.xml` from the
+command line.
+
+The plugin requires Maven 3.9.0 or later and Java 8 or later.
+
+## Common tasks
+
+Find out why a dependency is on the class path. The tree shows every path that
leads to the artifact:
+
+```shell
+mvn dependency:tree -Dincludes=org.apache.commons:commons-lang3
+```
+
+```text
+[INFO] org.example:app:jar:1.0
+[INFO] \- org.apache.commons:commons-text:jar:1.12.0:compile
+[INFO] \- org.apache.commons:commons-lang3:jar:3.14.0:compile
+```
+
+Check the declared dependencies against the classes that the compiled code
references:
+
+```shell
+mvn dependency:analyze
+```
+
+```text
+[WARNING] Used undeclared dependencies found: (in org.example:app)
+[WARNING] org.apache.commons:commons-lang3:jar:3.14.0:compile
+[WARNING] Unused declared dependencies found: (in org.example:app)
+[WARNING] commons-io:commons-io:jar:2.16.1:compile
+```
+
+The analysis works on bytecode, so it cannot see some uses of a dependency; see
+[Exclude dependencies from dependency
analysis](./examples/exclude-dependencies-from-dependency-analysis.html).
+
+Copy the runtime dependencies to `target/dependency`, for example to ship them
next to the application:
+
+```shell
+mvn dependency:copy-dependencies -DincludeScope=runtime
+```
+
+Download an artifact and its dependencies into the local repository, without a
project:
+
+```shell
+mvn dependency:get -Dartifact=org.apache.commons:commons-collections4:4.4
+```
## Goals Overview
-The Dependency plugin has several goals:
-
-- [dependency:add](./add-mojo.html) adds a dependency to the project's
`pom.xml` from the command line. Supports GAV shorthand, version inference from
`<dependencyManagement>`, BOM imports, profile targeting, and more. See
[Managing Dependencies](./examples/managing-dependencies.html).
-- [dependency:analyze](./analyze-mojo.html) analyzes the dependencies of this
project and determines which are: used and declared; used and undeclared;
unused and declared.
-- [dependency:analyze-dep-mgt](./analyze-dep-mgt-mojo.html) analyzes the
project's dependencies and lists mismatches between resolved dependencies and
those listed in your dependencyManagement section.
-- [dependency:analyze-exclusions](./analyze-exclusions-mojo.html) analyzes the
exclusions on dependencies and checks if the artifact actually brings in the
given dependency.
-- [dependency:analyze-only](./analyze-only-mojo.html) is the same as analyze,
but is meant to be bound in a pom. It does not fork the build and execute
test-compile.
-- [dependency:analyze-report](./analyze-report-mojo.html) analyzes the
dependencies of this project and produces a report that summarises which are:
used and declared; used and undeclared; unused and declared.
-- [dependency:analyze-report-only](./analyze-report-only-mojo.html) is the
same as analyze-report, but does not fork the build and execute test-compile.
-- [dependency:analyze-duplicate](./analyze-duplicate-mojo.html) analyzes the
`<dependencies/>` and `<dependencyManagement/>` tags in the pom.xml and
determines the duplicate declared dependencies.
-- [dependency:build-classpath](./build-classpath-mojo.html) tells Maven to
output the path of the dependencies from the local repository in a classpath
format to be used in java -cp. The classpath file may also be attached and
installed/deployed along with the main artifact.
-- [dependency:collect](./collect-mojo.html) collects the project dependencies
from the repository. It lists the groupId:artifactId:version information by
downloading the pom files without downloading the actual artifacts such as jar
files.
-- [dependency:copy](./copy-mojo.html) takes a list of artifacts defined in the
plugin configuration section and copies them to a specified location, renaming
them or stripping the version if desired. This goal can resolve the artifacts
from remote repositories if they don't exist in either the local repository or
the reactor.
-- [dependency:copy-dependencies](./copy-dependencies-mojo.html) takes the list
of project direct dependencies and optionally transitive dependencies and
copies them to a specified location, stripping the version if desired. This
goal can also be run from the command line.
-- [dependency:display-ancestors](./display-ancestors-mojo.html) 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. This goal can
also be run from the command line.
-- [dependency:get](./get-mojo.html) resolves a single artifact, eventually
transitively, from a specified remote repository.
-- [dependency:get-classpath](./get-classpath-mojo.html) resolves a single
artifact given by its coordinates, with its transitive runtime dependencies,
and outputs the classpath string to a file or the log. Like `get`, it needs no
project.
-- [dependency:go-offline](./go-offline-mojo.html) tells Maven to resolve
everything this project is dependent on (dependencies, plugins, reports) in
preparation for going offline.
-- [dependency:list](./list-mojo.html) alias for resolve that lists the
dependencies for this project.
-- [dependency:list-classes](./list-classes-mojo.html) displays the fully
package-qualified names of all classes found in a specified artifact.
-- [dependency:list-repositories](./list-repositories-mojo.html) collects all
project dependencies and then lists the repositories used by the build and by
the transitive dependencies.
-- [dependency:properties](./properties-mojo.html) sets a property for each
project dependency containing the artifact on the file system.
-- [dependency:purge-local-repository](./purge-local-repository-mojo.html)
tells Maven to clear dependency artifact files out of the local repository, and
optionally re-resolve them.
-- [dependency:remove](./remove-mojo.html) removes a dependency from the
project's `pom.xml` from the command line. Supports `<dependencyManagement>`,
BOM imports, profile targeting, and child module safety checks. See [Managing
Dependencies](./examples/managing-dependencies.html).
-- [dependency:resolve](./resolve-mojo.html) tells Maven to resolve all
dependencies and displays the version. **JAVA 9 NOTE:** _will display the
module name when running with Java 9._
-- [dependency:resolve-plugins](./resolve-plugins-mojo.html) tells Maven to
resolve plugins and their dependencies.
-- [dependency:resolve-sources](./resolve-sources-mojo.html) tells Maven to
resolve all dependencies and their source attachments, and displays the version.
-- [dependency:tree](./tree-mojo.html) displays the dependency tree for this
project.
-- [dependency:unpack](./unpack-mojo.html) like copy but unpacks.
-- [dependency:unpack-dependencies](./unpack-dependencies-mojo.html) like
copy-dependencies but unpacks.
-- [dependency:render-dependencies](./render-dependencies-mojo.html) like
build-classpath but with a custom Velocity template.
-## Usage
+The plugin has the following goals.
+
+### Inspecting dependencies
+
+- [dependency:tree](./tree-mojo.html) displays the dependency tree of the
project, as text or in the JSON, DOT,
+ GraphML, TGF or Mermaid format. See [Filtering the dependency
tree](./examples/filtering-the-dependency-tree.html)
+ and [Dependency tree output formats](./examples/tree-mojo.html).
+- [dependency:list](./list-mojo.html) lists the resolved dependencies of the
project. It is an alias for `resolve`.
+- [dependency:resolve](./resolve-mojo.html) resolves all dependencies of the
project and displays their versions, and
+ the Java module name of each one where it has one.
+- [dependency:resolve-sources](./resolve-sources-mojo.html) resolves all
dependencies of the project and their source
+ attachments, and displays their versions.
+- [dependency:resolve-plugins](./resolve-plugins-mojo.html) resolves the
plugins of the project and their dependencies.
+- [dependency:collect](./collect-mojo.html) lists the dependencies of the
project from their POM files only, without
+ downloading the artifacts themselves, such as jar files.
+- [dependency:list-repositories](./list-repositories-mojo.html) lists the
repositories that the build and its
+ transitive dependencies use.
+- [dependency:list-classes](./list-classes-mojo.html) displays the fully
qualified names of all classes in an
+ artifact.
+- [dependency:display-ancestors](./display-ancestors-mojo.html) displays all
ancestor POMs of the project, for example
+ for a continuous integration system that needs to know them.
-General instructions on how to use the Dependency Plugin can be found on the
[usage page](./usage.html). Some more specific use cases are described in the
following examples.
+### Analyzing dependencies
-If you have questions regarding the plugin's usage, please have a look at the
[FAQ](./faq.html) and feel free to contact the [user mailing
list](./mailing-lists.html). The posts to the mailing list are archived and
could already contain the answer to your question as part of an older thread.
Hence, it is also worth browsing/searching the [mail
archive](./mailing-lists.html).
+- [dependency:analyze](./analyze-mojo.html) analyzes the dependencies of the
project and determines which are used and
+ declared, used and undeclared, and unused and declared. It also reports
compile scope dependencies that only the
+ tests use. The goal runs the build up to `test-compile` first; to run the
analysis as part of the build, bind
+ `analyze-only` instead.
+- [dependency:analyze-only](./analyze-only-mojo.html) is the same as
`analyze`, but is meant to be bound in a POM. It
+ does not fork the build and run `test-compile`. It is bound to the `verify`
phase by default.
+- [dependency:analyze-report](./analyze-report-mojo.html) analyzes the
dependencies of the project and produces a
+ report of the used and declared, used and undeclared, and unused and
declared dependencies.
+- [dependency:analyze-report-only](./analyze-report-only-mojo.html) is the
same as `analyze-report`, but does not fork
+ the build and run `test-compile`.
+- [dependency:analyze-dep-mgt](./analyze-dep-mgt-mojo.html) lists mismatches
between the resolved dependencies of the
+ project and those listed in its `dependencyManagement` section.
+- [dependency:analyze-duplicate](./analyze-duplicate-mojo.html) finds
dependencies that are declared more than once in
+ the `dependencies` and `dependencyManagement` sections of the `pom.xml`.
+- [dependency:analyze-exclusions](./analyze-exclusions-mojo.html) checks
whether each exclusion on a dependency
+ actually removes an artifact that the dependency brings in.
-If you think the plugin is missing a feature or has a defect, you can file a
feature request or bug report in the [issue tracker](./issue-management.html).
When creating a new issue, please provide a comprehensive description of your
concern. Especially for fixing bugs it is crucial that the developers can
reproduce your problem. For this reason, entire debug logs, POMs or most
preferably little demo projects attached to the issue are very much
appreciated. Of course, patches are welcome [...]
+### Copying and unpacking artifacts
+
+- [dependency:copy](./copy-mojo.html) copies the artifacts listed in the
plugin configuration to a directory,
+ renaming them or stripping the version if desired. It resolves the artifacts
from remote repositories if they are
+ neither in the local repository nor in the reactor.
+- [dependency:copy-dependencies](./copy-dependencies-mojo.html) copies the
direct and, optionally, the transitive
+ dependencies of the project to a directory, stripping the version if desired.
+- [dependency:unpack](./unpack-mojo.html) is like `copy`, but unpacks the
artifacts.
+- [dependency:unpack-dependencies](./unpack-dependencies-mojo.html) is like
`copy-dependencies`, but unpacks the
+ artifacts.
+
+### Building class paths and properties
+
+- [dependency:build-classpath](./build-classpath-mojo.html) outputs the paths
of the dependencies in the local
+ repository in class path format, for use with `java -cp`. The class path
file can also be attached and installed
+ or deployed along with the main artifact.
+- [dependency:get-classpath](./get-classpath-mojo.html) resolves a single
artifact given by its coordinates, with its
+ transitive runtime dependencies, and outputs the class path to a file or the
log. Like `get`, it needs no project.
+- [dependency:render-dependencies](./render-dependencies-mojo.html) is like
`build-classpath`, but renders the
+ dependencies through a Velocity template. See [Render a Velocity
template](./examples/render-dependencies.html).
+- [dependency:properties](./properties-mojo.html) sets a property for each
dependency of the project that holds the
+ path of the artifact file.
+
+### Working with repositories
+
+- [dependency:get](./get-mojo.html) resolves a single artifact, and optionally
its dependencies, from the remote
+ repositories. It needs no project.
+- [dependency:go-offline](./go-offline-mojo.html) resolves everything the
project depends on (dependencies, plugins,
+ reports) in preparation for working offline.
+- [dependency:purge-local-repository](./purge-local-repository-mojo.html)
deletes the dependencies of the project from
+ the local repository, and optionally resolves them again.
+
+### Editing the POM
+
+- [dependency:add](./add-mojo.html) adds a dependency to the `pom.xml` of the
project. It supports GAV shorthand,
+ version inference from `dependencyManagement`, BOM imports and profiles. See
+ [Managing dependencies](./examples/managing-dependencies.html).
+- [dependency:remove](./remove-mojo.html) removes a dependency from the
`pom.xml` of the project. It supports
+ `dependencyManagement`, BOM imports and profiles, and warns when child
modules still use a managed dependency that
+ it removes. See
+ [Managing dependencies](./examples/managing-dependencies.html).
+
+### Other goals
+
+- [dependency:help](./help-mojo.html) displays help information on the plugin.
Run
+ `mvn dependency:help -Ddetail=true -Dgoal=<goal-name>` to display the
parameters of a goal.
+
+The `dependency:sources` goal was removed in 3.12.0; use
[dependency:resolve-sources](./resolve-sources-mojo.html)
+instead.
+
+## Usage
+
+General instructions on how to use the Dependency Plugin are on the [usage
page](./usage.html). The
+[FAQ](./faq.html) answers common questions; ask others on the [user mailing
list](./mailing-lists.html), whose
+archive may already hold the answer.
+
+To report a defect or request a feature, open an issue in the [issue
tracker](./issue-management.html). For a defect,
+include the steps to reproduce it, ideally a small project that shows the
problem. Contributors can check out the
+project from the [source repository](./scm.html) and find more information in
the
+[guide to helping with
Maven](https://maven.apache.org/guides/development/guide-helping.html).
## Examples
-The following examples show how to use the dependency plugin in more advanced
use-cases:
+The following examples show how to use the dependency plugin in more advanced
cases:
-- [Copying Specific Artifacts](./examples/copying-artifacts.html)
-- [Copying Project Dependencies](./examples/copying-project-dependencies.html)
-- [Unpacking Specific Artifacts](./examples/unpacking-artifacts.html)
-- [Unpacking the Project
Dependencies](./examples/unpacking-project-dependencies.html)
+- [Copying specific artifacts](./examples/copying-artifacts.html)
+- [Copying project dependencies](./examples/copying-project-dependencies.html)
+- [Unpacking specific artifacts](./examples/unpacking-artifacts.html)
+- [Unpacking the project
dependencies](./examples/unpacking-project-dependencies.html)
- [Rewriting target path and file name](./examples/unpacking-filemapper.html)
-- [Using Project Dependencies'
Sources](./examples/using-dependencies-sources.html)
-- [Failing the Build on Dependency Analysis
Warnings](./examples/failing-the-build-on-dependency-analysis-warnings.html)
-- [Exclude Dependencies from Dependency
Analysis](./examples/exclude-dependencies-from-dependency-analysis.html)
-- [Filtering the Dependency
Tree](./examples/filtering-the-dependency-tree.html)
-- [Managing Dependencies](./examples/managing-dependencies.html)
+- [Using project dependencies'
sources](./examples/using-dependencies-sources.html)
+- [Failing the build on dependency analysis
warnings](./examples/failing-the-build-on-dependency-analysis-warnings.html)
+- [Exclude dependencies from dependency
analysis](./examples/exclude-dependencies-from-dependency-analysis.html)
+- [Filtering the dependency
tree](./examples/filtering-the-dependency-tree.html)
+- [Dependency tree output formats](./examples/tree-mojo.html)
+- [Managing dependencies](./examples/managing-dependencies.html)
- [Purging the local repository](./examples/purging-local-repository.html)
-- [Tree Mojo](./examples/tree-mojo.html)
-- [Render Dependencies](./examples/render-dependencies.html)
-## Resources
+- [Render a Velocity template](./examples/render-dependencies.html)
-Here is a link that provides more reference regarding dependencies (i.e.
dependency management, transitive dependencies).
+## Resources
-- [Dependency
Mechanism](https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html)
+The [Introduction to the Dependency
Mechanism](https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html)
+explains transitive dependencies, dependency scopes and dependency management.