List of dependency jar files in Maven

Using Maven 2, is there a way I can list out the jar dependencies as just the file names?

mvn dependency:build-classpath 

can list the jar files, but that will include the full path to their location in my local repository. What I need is essentially just a list of the file names (or the file names that the copy-dependencies goal copied).

So the list I need would be something like

activation-1.1.jar,antlr-2.7.6.jar,aopalliance-1.0.jar etc...

ideally as a maven property, but I guess, a file such as build-classpath can generate will do.

What I am trying to achieve is writing a Bundle-ClassPath to an otherwise manually maintained MANIFEST.MF file for a OSGi bundle. (You shouldn't need to understand this bit to answer the question.)

To clarify: The question is not about how to write manifest headers into the MANIFEST.MF file in a jar (that is easily googleble). I am asking about how to get the data I want to write, namely the list shown above.


This command will generate the dependencies tree of your maven project:

$ mvn dependency:tree

I am sure that you will like the result :-)


Actually, for just the final list of jars, simply use

mvn dependency:list

Which is lot more simple than dependency:tree which is an overkill to simply get the final list as it shows detailed transitive tree and conflict resolution (with verbose).

Here's the doc for additional parameters