Eclipse下,修改MAVEN 中央仓库地址,解决maven下载慢问题

来源:互联网 发布:windows xp qq影音下载 编辑:程序博客网 时间:2024/06/06 03:44

好久不写代码,突然需要写点小程序,手生,记录知识点备忘:

表现:导入项目到工作空间后,编译时显示maven在下载资源,但速度巨慢,无法忍受。


eclipse中修改maven中央仓库:2种方式

方式1:(已测试)

作用于所有工作空间:

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

2、关闭窗口后重新打开,点击“open file”,在IDE中打开该配置文件,出现“could not read settings.xml”不必管。

3、复制下列内容至配置文件,其中<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"后配置生效,重新编译即可。


0 0