Maven: meaning of repository ID

眉间皱痕 提交于 2021-02-18 10:10:19

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/15011250/maven-meaning-of-repository-id

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!