Maven下載jar包太慢

問題:項目jar包依賴報錯,我刪掉所有庫重新下載,但是maven下了一個小時還在1%。。。

解決:

修改settings.xml,eg:我的文件是 E:\apache-maven-3.6.2\conf\settings.xml

  <!-- mirrors
   | This is a list of mirrors to be used in downloading artifacts from remote repositories.
   |
   | It works like this: a POM may declare a repository to use in resolving certain artifacts.
   | However, this repository may have problems with heavy traffic at times, so people have mirrored
   | it to several places.
   |
   | That repository definition will have a unique id, so we can create a mirror reference for that
   | repository, to be used as an alternate download site. The mirror site will be the preferred
   | server for that repository.
   |-->
  <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>mirrorId</id>
      <mirrorOf>repositoryId</mirrorOf>
      <name>Human Readable Name for this Mirror.</name>
      <url>http://my.repository.com/repo/path</url>
    </mirror>
     -->
	 <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>

不到1分鐘,下載完了,,,,感動得我都要哭了~

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章