Maven筆記|Maven配置阿里雲鏡像倉庫

1.說明

2-5點爲第6點的拆分說明,如果只需要配置的同學可直接跳至第6點獲取完全配置即可。

2.配置本地倉庫地址

<localRepository>/Volumes/mac/repository</localRepository>

3.配置阿里Maven倉庫

<mirrors>
    <mirror>
        <id>alimaven</id>
        <name>ailiyun maven</name>
        <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
        <mirrorOf>central</mirrorOf>
    </mirror>
</mirrors>

4.配置所選擇鏡像

<profiles>
    <profile>
        <!--配置激活文件名,唯一不重複-->
        <id>alimaven</id>
        <repositories>
            <repository>
                <id>central</id>
                <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
                <releases>
                    <enabled>true</enabled>
                </releases>
                <snapshots>
                    <enabled>true</enabled>
                </snapshots>
            </repository>
        </repositories>
        <pluginRepositories>
            <pluginRepository>
                <id>central</id>
                <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
                <releases>
                    <enabled>true</enabled>
                </releases>
                <snapshots>
                    <enabled>true</enabled>
                </snapshots>
            </pluginRepository>
        </pluginRepositories>
    </profile>
</profiles>

5.選擇要激活的配置

<activeProfiles>
   <activeProfile>alimaven</activeProfile>
</activeProfiles>

6.阿里雲鏡像完全配置

<?xml version="1.0" encoding="UTF-8"?>

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<!--本地倉庫地址-->
<localRepository>/Volumes/mac/repository</localRepository>
<mirrors>
  <mirror>
      <id>alimaven</id>
      <name>ailiyun maven</name>
      <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
      <mirrorOf>central</mirrorOf>
  </mirror>
</mirrors>

<!--根據配置進行激活選擇-->
<profiles>
  <profile>
      <!--配置激活文件名,唯一不重複-->
      <id>alimaven</id>
      <repositories>
          <repository>
              <id>central</id>
              <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
              <releases>
                  <enabled>true</enabled>
              </releases>
              <snapshots>
                  <enabled>true</enabled>
              </snapshots>
          </repository>
      </repositories>
      <pluginRepositories>
          <pluginRepository>
              <id>central</id>
              <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
              <releases>
                  <enabled>true</enabled>
              </releases>
              <snapshots>
                  <enabled>true</enabled>
              </snapshots>
          </pluginRepository>
      </pluginRepositories>
  </profile>
</profiles>
<activeProfiles>
  <activeProfile>alimaven</activeProfile>
</activeProfiles>
</settings>

發佈了48 篇原創文章 · 獲贊 10 · 訪問量 7097
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章