将所有 maven 依赖项下载到不在存储库中的目录? [英] Downloading all maven dependencies to a directory NOT in repository?

查看:29
本文介绍了将所有 maven 依赖项下载到不在存储库中的目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始将我的项目转换为 maven,因为我需要使用一个仅在 maven 上以二进制形式分发的库,但是在我的头撞在墙上太久之后,我决定停止伤害自己只需使用 Ant.我只想让 maven 将 jar 及其所有传递依赖项下载到我选择的目录中,这样我就可以像往常一样将它们检入我的 SCM 并再次成为一名幸福的开发人员.
任何想法如何轻松做到这一点?

I started to convert my project to maven because I needed to use a library that was distributed in binary form over maven only, but after banging my head against the wall on it for far too long I've decided to stop hurting myself and just use Ant. I'd like to just have maven download the jar and all of its transitive dependencies into a directory of my choosing so I can just check them into my SCM as I normally enjoy and be a blissful developer once again.
Any ideas how to do that easily?

推荐答案

maven 依赖插件 可以潜在地解决您的问题.

The maven dependency plugin can potentially solve your problem.

如果您有一个 pom 并指定了所有项目依赖项,那么您需要做的就是运行

If you have a pom with all your project dependencies specified, all you would need to do is run

mvn dependency:copy-dependencies

然后你会发现 target/dependencies 文件夹里装满了所有的依赖,包括可传递的.

and you will find the target/dependencies folder filled with all the dependencies, including transitive.

添加 Gustavo 下面的回答:下载依赖,可以使用

Adding Gustavo's answer from below: To download the dependency sources, you can use

mvn dependency:copy-dependencies -Dclassifier=sources

(通过 Apache Maven 依赖插件文档).

这篇关于将所有 maven 依赖项下载到不在存储库中的目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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