Here’s a one-liner (well, two) that neatly lists all the Maven dependencies from your project. Useful to check their licenses, for example.
# first grab all dependencies mvn dependency:resolve # then list them with -o to keep noise low, # remove extra information and duplicates mvn -o dependency:list \ | grep ":.*:.*:.*" \ | cut -d] -f2- \ | sed 's/:[a-z]*$//g' \ | sort -u
The output looks like this:
asm:asm:jar:1.5.3 asm:asm:jar:3.1 biz.aQute:bnd:jar:0.0.169 cglib:cglib:jar:2.1_3 classworlds:classworlds:jar:1.1 classworlds:classworlds:jar:1.1-alpha-2 ...
so it’s also useful to detect multiple versions of the same dependency in a multi-module project.
The dependency convergence report would also give you a nice HTML page that points out multiple versions of the same dependency in a multi-module project, and the licenses :)
I have a maven project which have modules(OSGi bundles) inside it.
I have to write list of dependencies(no duplicates) from all of these modules in a file while building from top level POM file.
Can you pls suggest how to do this?
I have tried following but dependencies are not listed in the created file:
org.apache.maven.plugins
maven-dependency-plugin
list-dependencies
generate-sources
resolve
target/dependencies.list
Best Regards,
Amit