For showing the dependency tree of an existing project (with a pom.xml
), there's mvn dependency:tree.
But sometimes, I want to have a look at the dependencies without having to create a pom.xml
and adding the dependency there.
So, is there a command for showing the dependency tree of a specific groupId:artifactId:version without having an existing project?
(I'd also be happy if there is another tool that has something for this, maybe Gradle.)
You definitely need a pom for resolving dependencies, that's where dependency information is stored. But you can workaround having a project:
Get the pom of your artifact:
mvn dependency:get \
-Dartifact=groupId:artifactId:version:pom \
-DremoteRepositories=default::http://repo.url... \
-Dtransitive=false -Ddest=pom.xml
Run mvn dependency:tree
.
This worked for me. Or using dependency:copy:
Run dependency:copy
:
mvn dependency:copy \
-Dartifact=groupId:artifactId:version:pom \
-DoutputDirectory=.
mv artifactId-version.pom pom.xml
.
Run mvn dependency:tree
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With