我们有一个有多个父母/孩子家长的项目。所有POMs都指向一个用于解决所有Maven依赖关系的存储库。
现在我有一个需求:在一个POM中,必须从repo1下载一个jar,从repo2下载rest 4-5 jar。
你怎么能这么做?
发布于 2016-07-09 05:38:41
What I have understand the,
I can setup maven repo in artifactory/nexus
e.g. http://localhost:18081/artifactory/ --> L1
1. create remote(R1) repository in artifactory, which can point URL to outside repository, hosted by artifactory/nexus
e.g http://remotehost:18081/artifactory/remote-repo1
2. create a "virtual" repository(V1) in my artifactory and add remote(R1) in to this V1.
3. Let all my poms points to my local artifactory virtual repository(V1),
e.g.>http://localhost:18081/artifactory/virtual
that way, maven will look
a. local .m2 folder
b. then look for jars in virtual repo of my artifactory
hence virtual will look
b1. all local repo
b2. all remote cache repo
b3. all remote repo --> e.g.http://remotehost:18081/artifactory/remote-repo1
I am experimenting this,once succeed, i will update
EDIT :
This has worked for me, the only hiccup I faced was my ~/.m2/settings.xml
the snapshot was false, and my jar in remote repo is a snapshot jar.
After changing this value to true, now its fetching the jars :)
</profile>
<profile>
<id>virtual-repo</id>
<repositories>
<repository>
<id>central</id>
<url><repo_url></url>
<snapshots>
**<enabled>true</enabled>**
</snapshots>
</repository>
</repositories>发布于 2016-07-02 20:52:59
一句话-是的。Maven的依赖解决机制完全独立于存储库机制。从理论上讲,您可以将每个罐子都从自己的存储库中传递出来(不管实际这样做多么荒谬)。
https://stackoverflow.com/questions/38164370
复制相似问题