妙博客

主机评测 香港服务器 洛杉矶VPS测评

maven设置国内源

1.打开idea,点击file->settings,搜索maven,然后勾上maven路径


image.png

2.复制setting.xml到上述目录,然后在mirrors结点内添加一个结点

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


下面是完整的settings.xml:

<?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">
 
  <pluginGroups>
  </pluginGroups>
  <proxies>
  </proxies>
  <servers>
  </servers>
  
  <mirrors>
    <mirror>
         <id>aliyunmaven</id>
         <mirrorOf>central</mirrorOf>
         <name>aliyunCentral仓库</name>
         <url>https://maven.aliyun.com/repository/central</url>
        </mirror>
        <mirror>
          <id>repo1</id>
          <mirrorOf>central</mirrorOf>
          <name>central repo</name>
          <url>http://repo1.maven.org/maven2/</url>
        </mirror>
        <mirror>
         <id>aliyunmaven</id>
         <mirrorOf>apache snapshots</mirrorOf>
         <name>aliyunApache仓库</name>
         <url>https://maven.aliyun.com/repository/apache-snapshots</url>
        </mirror>
  </mirrors>
 
  <profiles>
    <repositories>
       <repository>
            <id>aliyunmaven</id>
            <name>aliyunmaven</name>
            <url>https://maven.aliyun.com/repository/public</url>
            <layout>default</layout>
            <releases>
                    <enabled>true</enabled>
            </releases>
            <snapshots>
                    <enabled>true</enabled>
            </snapshots>
        </repository>
        <repository>
            <id>MavenCentral</id>
            <url>http://repo1.maven.org/maven2/</url>
        </repository>
        <repository>
            <id>aliyunmavenApache</id>
            <url>https://maven.aliyun.com/repository/apache-snapshots</url>
        </repository>
    </repositories>
  </profiles>
</settings>


Copyright Your 142132.com Rights Reserved. 赣ICP备17010829号-2