Eclipse自帶Maven配置國內鏡像下載

1.Windows——>Preferences——>Maven——>User Settings中查看maven settings.xml的位置。
在這裏插入圖片描述
2.如果沒有藍色的open file字樣,可以進入到C:\Users\HTC.m2文件夾,新建一個settings.xml文件,並添加內容。

<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">  
      
    <!-- 這個是配置阿里Maven鏡像 -->  
    <mirrors>  
        <mirror>  
          <id>aliyun</id>  
          <name>aliyun</name>  
          <url>http://maven.aliyun.com/nexus/content/groups/public/</url>  
          <mirrorOf>central</mirrorOf>  
        </mirror>  
    </mirrors>  
      
    <profiles>  
        <profile>  
            <id>nexus</id>  
            <repositories>  
                <repository>  
                    <id>central</id>  
                    <url>http://repo.maven.apache.org/maven2</url>  
                    <snapshots>  
                        <enabled>false</enabled>  
                    </snapshots>  
                </repository>  
                <repository>  
                    <id>ansj-repo</id>  
                    <name>ansj Repository</name>  
                    <url>http://maven.nlpcn.org/</url>  
                    <snapshots>  
                        <enabled>false</enabled>  
                    </snapshots>  
                </repository>  
            </repositories>  
        </profile>  
    </profiles>  
  
    <activeProfiles>  
        <activeProfile>nexus</activeProfile>  
    </activeProfiles>  
</settings>

3.如果有open file字樣,可以在點擊open file,編輯文件,將原來的鏡像文件替換爲國內鏡像即可。

<mirror>
        <id>alimaven</id>
        <mirrorOf>central</mirrorOf>
        <name>aliyun maven</name>
      <url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
</mirror>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章