[交流分享] maven编译如何优先从Kunpeng镜像下载jar包

场景:

    Maven仓部分jar包依赖x86 so,无法在鲲鹏上直接使用,需要在鲲鹏上重新编译,部分jar包已编译好放在鲲鹏maven仓内(https://mirrors.huaweicloud.com/repository/maven/kunpeng/),可以直接使用,只需在maven配置文件内配置远程仓优先从鲲鹏maven仓搜索,找不到再从其它仓搜索。

 

 

配置文法:

     1.  编辑配置文件${maven.home}/conf/settings.xml

     2.  profiles标签下增加鲲鹏maven仓

 

<profile>

      <id>securecentral</id>

      <activation>

            <activeByDefault>true</activeByDefault>

      </activation>

 

      <repositories>

        <repository>

          <id>1central</id>

          <url>https://mirrors.huaweicloud.com/repository/maven/kunpeng/</url>

          <releases>

            <enabled>true</enabled>

          </releases>

        </repository>

 

        <repository>

          <id>2central</id>

          <url> https://mirrors.huaweicloud.com/repository/maven/</url>

          <releases>

            <enabled>true</enabled>

          </releases>

        </repository>

      </repositories>

 

 

      <pluginRepositories>

        <pluginRepository>

          <id>3central</id>

          <url>https://mirrors.huaweicloud.com/repository/maven/kunpeng/</url>

          <releases>

            <enabled>true</enabled>

          </releases>

        </pluginRepository>

        <pluginRepository>

          <id>4central</id>

          <url>https://mirrors.huaweicloud.com/repository/maven/</url>

          <releases>

            <enabled>true</enabled>

          </releases>

        </pluginRepository>

      </pluginRepositories>

    </profile>