如何在Maven中指定依赖关系的存储库 [英] How to specify a repository for a dependency in Maven

查看:181
本文介绍了如何在Maven中指定依赖关系的存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在具有多个依赖关系和存储库的项目中,Maven用于下载依赖关系的尝试和错误方法有点麻烦和缓慢,所以我想知道是否有任何方法为某些已知的依赖关系设置一个特定的备份。 / p>

例如,我想要bouncycastle直接检查BouncyCastle的Maven repo,在 http://repo2.maven.org/maven2/org/bouncycastle/ 而不是官方的Maven。

解决方案

不可能。 Maven会以声明顺序检查存储库,直到给定的工件得到解决(或不)。



某些存储库管理器可以做一些接近这个的工作。例如,Nexus有一个路线功能与此相当。


In projects with several dependencies and repositories, the try-and-error approach of Maven for downloading dependencies is a bit cumbersome and slow, so I was wondering if there is any way to set an specific repo for some declared dependencies.

For example, I want for bouncycastle to check directly BouncyCastle's Maven repo at http://repo2.maven.org/maven2/org/bouncycastle/ instead of official Maven.

解决方案

Not possible. Maven checks the repositories in their declaration order until a given artifact gets resolved (or not).

Some repository manager can do something approaching this though. For example, Nexus has a routes feature that does something equivalent.

这篇关于如何在Maven中指定依赖关系的存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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