Maven中的依赖jar文件列表

List of dependency jar files in Maven(Maven中的依赖jar文件列表)
本文介绍了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 写入 OSGi 捆绑包的其他手动维护的 MANIFEST.MF 文件.(你不需要理解这一点来回答这个问题.)

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文件列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

JPMS/Jigsaw Missing Main Class in Module(JPMS/Jigsaw模块中缺少主类)
Can not run JAVAFX .jar File (many errors occurred)(无法运行JavaFX.jar文件(出现许多错误))
JPMS and fatuber executable JAR - how it works together?(JPMS和FATUBER可执行JAR--它是如何协同工作的?)
Use jdk.internal.net.http(使用jdk.inder.net.http)
javax.annotation classes and Java 11 JDK(Javax.Annotation类和Java 11 JDK)
Are Filer#39;s originating elements useful?(FILLER的原始元素有用吗?)