Maven中依赖jar文件的列表 [英] List of dependency jar files in Maven

查看:428
本文介绍了Maven中依赖jar文件的列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Maven 2,有没有办法可以将jar依赖项列为文件名?

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

mvn dependency:build-classpath 

可以列出jar文件,但这将包括其位置的完整路径我的本地存储库。我需要的只是一个文件名列表(或复制依赖目标复制的文件名)。

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...

理想情况下作为maven属性,但我想,像build-classpath这样的文件可以生成。

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

我想要实现的是将 Bundle-ClassPath 写入另一个手动维护的OSIFEST.MF文件中以获取OSGi束。 (你不应该理解这一点来回答这个问题。)

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.)

澄清:关于如何写清单的问题是标题进入jar中的MANIFEST.MF文件(很容易googleble)。我问的是如何获取我想要写的数据,即上面显示的列表。

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.

推荐答案

此命令将生成你的maven项目的依赖树:

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

$ mvn dependency:tree

我相信你会喜欢这样的结果: - )

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

这篇关于Maven中依赖jar文件的列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆