简体   繁体   English

maven添加新的远程存储库

[英]maven add new remote repository

How can I add a new remote repository in the maven user settings config file? 如何在Maven用户设置配置文件中添加新的远程存储库? I added a new option for the one with the id "softwarementors", but when I run the update target on the maven project, it simply redirects to the configured nexus server nexus_server_ip_address. 我为id为“ softwarementors”的那个添加了一个新选项,但是当我在maven项目上运行更新目标时,它只是重定向到已配置的nexus服务器nexus_server_ip_address。

How can I prevent this? 我该如何预防? How do I need to adjust the maven config file in order to add a new remote repository. 我需要如何调整Maven配置文件才能添加新的远程存储库。 I replaced the nexus server's ip address with 我将nexus服务器的IP地址替换为

<mirrors>
    <mirror>
        <!--This sends everything else to /public -->
        <id>nexus</id>
        <mirrorOf>*</mirrorOf>
        <url>nexus_server_ip_address/nexus/content/groups/public</url>
    </mirror>
</mirrors>
<profiles>
    <profile>
        <id>nexus</id>
        <repositories>
            <repository>
                <id>central</id>
                <url>http://central</url>
                <releases>
                    <enabled>true</enabled>
                </releases>
                <snapshots>
                    <enabled>true</enabled>
                </snapshots>
            </repository>
            <repository>
                <id>softwarementors</id>            <url>https://repository.sonatype.org/content/groups/forge/com/softwarementors/ex    tjs/directjngine/2.2/</url>
                <releases>
                    <enabled>true</enabled>
                </releases>
                <snapshots>
                    <enabled>true</enabled>
                </snapshots>
            </repository>
        </repositories>
        <pluginRepositories>
            <pluginRepository>
                <id>central</id>
                <url>http://central</url>
                <releases>
                    <enabled>true</enabled>
                </releases>
                <snapshots>
                    <enabled>true</enabled>
                </snapshots>
            </pluginRepository>
        </pluginRepositories>
    </profile>
</profiles>
<activeProfiles>
    <activeProfile>nexus</activeProfile>
</activeProfiles>

The mirrorOf pattern of * causes any repository request to be redirected to this mirror and to your single repository group, which in the example is the public group. *的mirrorOf模式会导致将任何存储库请求重定向到该镜像以及您的单个存储库组,在示例中为公共组。

https://books.sonatype.com/nexus-book/2.8/reference/maven-sect-single-group.html https://books.sonatype.com/nexus-book/2.8/reference/maven-sect-single-group.html

Solution 1 : add softwarementors to Nexus

Solution 2 :
            Add this.

                <mirror>
                  <id>softwarementors</id>
                  <mirrorOf>softwarementors</mirrorOf>
                  <url>https://repository.sonatype.org/content/groups/forge/com/softwarementors/extjs/directjngine/2.2/</url>
                </mirror> 

                <repository>
                    <id>softwarementors</id>
                    <name>softwarementors</name>        
                    <url>https://repository.sonatype.org/content/groups/forge/com/softwarementors/extjs/directjngine/2.2/</url>
                </repository>

Solution 3:

<mirror>
       <!--This sends everything else to /public -->
       <id>nexus</id>
       <mirrorOf>*,!softwarementors</mirrorOf>
       <url>nexus_server_ip_address/nexus/content/groups/public</url>
</mirror>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM