eclipse下配置maven的下载镜像

1.逐项打开:eclipse->preference->Maven->user Settings 。按窗口中的User Settings文本框显示的路径,创建settings.xml文件,也可以修改路径过后创建该文将。

2.关闭窗口重新打开过后会出现"open file",点击"open file",在eclipse中打开该配置文件,出现"could not read settings.xml"不需要管。直接在eclipse中添加内容。

3.复制下列内容到settings.xml中。<mirror></mirror>部分为下载镜像设置。该内容为国内阿里的镜像

<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">  
    <mirrors>  
        <!-- mirror | Specifies a repository mirror site to use instead of a given   
            repository. The repository that | this mirror serves has an ID that matches   
            the mirrorOf element of this mirror. IDs are used | for inheritance and direct   
            lookup purposes, and must be unique across the set of mirrors. | -->  
         <mirror>  
            <id>alimaven</id>  
            <name>aliyun maven</name>  
            <url>http://maven.aliyun.com/nexus/content/groups/public/</url>  
            <mirrorOf>central</mirrorOf>  
          </mirror>  
          
          <mirror>   
            <id>uk</id>    
            <mirrorOf>central</mirrorOf>    
            <name>Human Readable Name for this Mirror.</name>    
            <url>http://uk.maven.org/maven2/</url>   
          </mirror>  
          
           <mirror>  
            <id>CN</id>  
            <name>OSChina Central</name>  
            <url>http://maven.oschina.net/content/groups/public/</url>  
            <mirrorOf>central</mirrorOf>  
          </mirror>  
          
          <mirror>  
            <id>nexus</id>  
            <name>internal nexus repository</name>  
            <url>http://repo.maven.apache.org/maven2</url>  
            <mirrorOf>central</mirrorOf>  
          </mirror>  
    </mirrors>  
  
    <profiles>  
        <profile>  
            <id>default</id>  
            <repositories>  
                <repository>  
                    <id>nexus</id>  
                    <name>local private nexus</name>  
                    <url>http://maven.oschina.net/content/groups/public/</url>  
                    <releases>  
                        <enabled>true</enabled>  
                    </releases>  
                    <snapshots>  
                        <enabled>false</enabled>  
                    </snapshots>  
                </repository>  
            </repositories>  
            <pluginRepositories>  
                <pluginRepository>  
                    <id>nexus</id>  
                    <name>local private nexus</name>  
                    <url>http://maven.oschina.net/content/groups/public/</url>  
                    <releases>  
                        <enabled>true</enabled>  
                    </releases>  
                    <snapshots>  
                        <enabled>false</enabled>  
                    </snapshots>  
                </pluginRepository>  
            </pluginRepositories>  
        </profile>  
    </profiles>  
</settings>

4.保存代码后apply。

原文地址:https://www.cnblogs.com/dbutil/p/8509650.html