maven的setting配置远程仓库,优先使用公司的maven仓库,如果找不到再去阿里的maven库找。

 

maven的setting,配置远程库。

  <mirrors>
    <mirror>
      <id>mirror-local</id>
      <!-- 优先从这个id的远程仓库取 -->
      <mirrorOf>local-repo</mirrorOf> 
      <url>http://10.1.1.1:8081/nexus/content/groups/public/</url>
    </mirror>
    <mirror>
      <id>mirror-aliyun</id>
      <!-- 不在本地仓库的文件才从该镜像获取 -->
      <mirrorOf>external:*</mirrorOf> 
      <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
    </mirror>
  </mirrors>

 

 

本地库配置

</profiles>
    <profile>
        <id>profile-local</id>
        <activation>
            <activeByDefault>true</activeByDefault>    
        </activation>
        <repositories>
            <repository>
                <id>local-repo</id>
                <url>http://10.1.1.1:8081/nexus/content/groups/public</url>
                <releases><enabled>true</enabled></releases> 
                <snapshots>
                    <enable>true</enable>
                    <updatePolicy>daily</updatePolicy>    
                </snapshots>
            </repository>
        </repositories>
    </profile>
</profiles>

<activeProfiles> <activeProfile>profile-local</activeProfile> </activeProfiles>

 

posted @ 2021-06-02 17:30  新手娃娃菜  阅读(1339)  评论(0编辑  收藏  举报