Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven: meaning of repository ID

Tags:

maven

In my POM file, I'm specifying two repositories:

<repositories>
    <repository>
        <id>myid</id>
        <url>http://url1</url>
    </repository>
    <repository>
        <id>myid</id>
        <url>http://url2</url>
    </repository>
</repositories>

So, from the Maven documentation, I got the impression that the id element should cross-reference with a settings.xml server entry, to specify authentication information. Both http://url1 and http://url2, in my case, require the very same authentication data; that is why I'm using the same id for both.

Still, Maven complains, saying that the id element must be unique.

What gives? What exactly is that purpose of the id element? I know (for sure) that Maven uses it to get authentication data - which is why things work when I only specify one repository. Why do I have to duplicate my authentication data? what am I missing?

like image 930
Isaac Avatar asked Feb 21 '13 20:02

Isaac


People also ask

What is ID repository?

An identity repository is a data store where information about users and groups in a company or organization is stored. The Access Manager Identity Repository Framework and related APIs are a model by which plug-ins can be written that allow communication with different types of identity repositories.

What does repository mean in Maven?

A repository in Maven holds build artifacts and dependencies of varying types. There are exactly two types of repositories: local and remote: the local repository is a directory on the computer where Maven runs. It caches remote downloads and contains temporary build artifacts that you have not yet released.

What is the groupId in Maven?

groupId This element indicates the unique identifier of the organization or group that created the project. The groupId is one of the key identifiers of a project and is typically based on the fully qualified domain name of your organization. For example org. apache. maven.

How does Maven know which repository?

Maven just goes through the list and looks into all the repositories. It is not possible to tie dependencies to special repositories.


1 Answers

ID has to be unique. Use 2 login configurations in your settings.xml.

like image 147
Liran Zelkha Avatar answered Oct 28 '22 06:10

Liran Zelkha