Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add Maven dependencies from different repositories

Tags:

java

maven-2

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

<repository>
    <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?

like image 830
Stephane Grenier Avatar asked Feb 25 '10 18:02

Stephane Grenier


People also ask

How do I add dependency from one project to another?

Right-click the utility project, and select Maven>Add Dependency. Type a dependency name in the Enter groupID… field (e.g., commons-logging) to search for a dependency. Select the dependency, and click OK.

How do I force Maven to download dependencies from remote repository?

We can use -U/--update-snapshots flag when building a maven project to force maven to download dependencies from the remote repository. Here, -U,--update-snapshots : Forces a check for missing releases and updated snapshots on remote repositories.


1 Answers

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".

like image 165
matt b Avatar answered Sep 28 '22 06:09

matt b