List of dependency jar files in Maven

Posted by Sindri Traustason on Stack Overflow See other posts from Stack Overflow or by Sindri Traustason
Published on 2008-11-10T17:36:11Z Indexed on 2010/05/14 13:14 UTC
Read the original article Hit count: 181

Filed under:
|
|
|

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.

© Stack Overflow or respective owner

Related posts about java

Related posts about maven-2