maven地址配置为阿里maven仓库,附ali maven官方指南链接

 一、参考链接

官方指南

链接地址:https://help.aliyun.com/document_detail/102512.html?spm=a2c40.aliyun_maven_repo.0.0.36183054BpUElw

或者:https://maven.aliyun.com/mvn/guide

官方指南配置:

<mirror>
    <id>aliyunmaven</id>
    <mirrorOf>*</mirrorOf>
    <name>阿里云公共仓库</name>
    <url>https://maven.aliyun.com/repository/public</url>
</mirror>

 二、参考配置 

1.设置本地仓库路径

  <!-- localRepository
   | The path to the local repository maven will use to store artifacts.
   |
   | Default: ${user.home}/.m2/repository
  <localRepository>/path/to/local/repo</localRepository>
  -->
  
  <localRepository>D:\dvpt_env\mvn-repo</localRepository>

2.mirros节点中加入mirro子节点

public仓库为central仓和jcenter仓的聚合仓

<mirror>
    <id>aliyunmaven</id>
    <mirrorOf>*</mirrorOf>
    <name>阿里云公共仓库</name>
    <url>https://maven.aliyun.com/repository/public</url>
</mirror> 

@deprecate

<mirror>
            <id>nexus-aliyun</id>
            <mirrorOf>central</mirrorOf>
            <name>Nexus aliyun</name>
            <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
    </mirror>

 

3.profiles节点中加入profile子节点

非必要配置。

<profile>
    <id>jdk-1.8</id>
    <activation>
        <jdk>1.8</jdk>
    </activation>
    <repositories>
        <!-- public是central仓和jcenter仓的聚合仓。已配置在mirror节点 -->
        <!-- 
        <repository>
            <id>public</id>
            <url>https://maven.aliyun.com/repository/public</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
         -->
        <!-- 添加spring代理仓 -->
        <repository>
            <id>spring</id>
            <url>https://maven.aliyun.com/repository/spring</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
    </repositories>
</profile>

 

 .

posted @ 2019-10-27 15:53  毁乐乖狂,自有诪张  阅读(9625)  评论(0编辑  收藏  举报