List of dependency jar files in Maven(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文件列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Maven中的依赖jar文件列表


- Java包名称中单词分隔符的约定是什么? 2022-01-01
- Safepoint+stats 日志,输出 JDK12 中没有 vmop 操作 2022-01-01
- Jersey REST 客户端:发布多部分数据 2022-01-01
- 从 finally 块返回时 Java 的奇怪行为 2022-01-01
- 如何使用WebFilter实现授权头检查 2022-01-01
- Spring Boot连接到使用仲裁器运行的MongoDB副本集 2022-01-01
- C++ 和 Java 进程之间的共享内存 2022-01-01
- 将log4j 1.2配置转换为log4j 2配置 2022-01-01
- value & 是什么意思?0xff 在 Java 中做什么? 2022-01-01
- Eclipse 插件更新错误日志在哪里? 2022-01-01