如何获取pom.xml中提到的所有指定的jar和传递性依赖的jar? [英] How to get all the specified jars mentioned in the pom.xml and transitively dependent jars?

查看:510
本文介绍了如何获取pom.xml中提到的所有指定的jar和传递性依赖的jar?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只需要使用POM文件,我需要编写一个脚本来自动下载所有的依赖文件并输出到自定义的路径。

I have only the POM file using which I need to write a script to automatically download all the dependency files and output to custom mentioned path.

我只是想在命令行中使用mvn命令实现上述。

I just want to achieve the above using mvn command in command line.

推荐答案

听起来你正在寻找 mvn依赖关系:copy-dependencies

It sounds like you're looking for mvn dependency:copy-dependencies:


依赖关系:copy-dependencies 将项目列表依赖关系和可选的传递依赖关系,并将它们复制到指定的位置,如果需要,剥离版本。这个目标也可以从命令行运行。

dependency:copy-dependencies takes the list of project direct dependencies and optionally transitive dependencies and copies them to a specified location, stripping the version if desired. This goal can also be run from the command line.

从项目根目录中调用命令行

From the project root, invoking on the command line

mvn dependency:copy-dependencies -DoutputDirectory=...

将所有项目的直接和传递依赖项复制到指定的输出目录。如果这些依赖关系尚未在您的本地Maven存储库中,那么它们将从Maven Central(或从自定义存储库)下载。

will copy all your project direct and transitive dependencies to the specified output directory. If those dependencies are not already in your local Maven repository, they will be downloaded from Maven Central (or from a custom repository).

这篇关于如何获取pom.xml中提到的所有指定的jar和传递性依赖的jar?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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