开发者

How to add Maven dependencies from different repositories

开发者 https://www.devze.com 2022-12-21 11:50 出处:网络
For example, let\'s say I have a Maven build file that has dependencies located in two different repositories:

For example, let's say I have a Maven build file that has dependencies located in two different repositories:

<repository>
    开发者_JS百科<id>id1</id>
    <name>id1</name>
    <url>http://localhost/mavenRepo/repository1</url>
</repository>

<repository>
    <id>id2</id>
    <name>id2</name>
    <url>http://localhost/mavenRepo/repository2</url>
</repository>

With one dependencies from the first repository and the other from the second repository. How can I do this?


Just list all the dependencies in your <dependencies> section, and Maven will contact each repository in turn (including your local repository) to find them.

A POM file has no concept of "get these dependencies from this repository and get these dependencies from that repository".


How can you do what? What is the problem? Just add the dependencies and Maven will try to resolve them from central repository and then fallback on the next declared repository if not found and so on.

0

精彩评论

暂无评论...
验证码 换一张
取 消