Maven error: Unable to get resource / Server redirected too many times

只愿长相守 提交于 2020-02-02 04:29:06

问题


Our proxy went down and I tried to update dependencies with Maven while it was off. Since then I can't download anything with Maven. I get this error for everything. I tried -U option, deleting my local repository and tried different Maven version (2.0.9, 2.2.1) but it doesn't work. Any idea how to solve this?

Earlier it also said 'repository will be blacklisted' to all of them.

Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-compiler-plugin/2.1/maven-compiler-plugin-2.1.pom
[WARNING] Unable to get resource 'org.apache.maven.plugins:maven-compiler-plugin:pom:2.1'
from repository central (http://repo1.maven.org/maven2):
Error transferring file: Server redirected too many times (20) org.apache.maven.plugins:maven-compiler-plugin:pom:2.1 from the specified remote repositories: jboss-snapshot (http://snapshots.jboss.org/maven2), central (http://repo1.maven.org/maven2), JBoss Repo (http://repository.jboss.com/maven2), spring-maven-snapshot (http://maven.springframework.org/snapshot), com.springsource.repository.bundles.external (http://repository.springsource.com/maven/bundles/external), com.springsource.repository.bundles.snapshot (http://repository.springsource.com/maven/bundles/snapshot), jboss (http://repository.jboss.com/maven2), com.springsource.repository.bundles.release (http://repository.springsource.com/maven/bundles/release), jboss-snapshot-plugins (http://snapshots.jboss.org/maven2), com.springsource.repository.bundles.milestone (http://repository.springsource.com/maven/bundles/milestone), jboss-plugins (http://repository.jboss.com/maven2) at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:228) at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:90) at org.apache.maven.project.DefaultMavenProjectBuilder.findModelFromRepository(DefaultMavenProjectBuilder.java:558) ... 25 more Caused by: org.apache.maven.wagon.ResourceDoesNotExistException: Unable to download the artifact from any repository at org.apache.maven.artifact.manager.DefaultWagonManager.getArtifact(DefaultWagonManager.java:404) at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:216) ... 27 more

回答1:


I got the same error with Windows ISA proxy. I had to put my Windows domain name and username in ~/.m2/settings.xml like this:

<username>DOMAIN\USERNAME</username>



回答2:


I don't know how this solved it but I changed my password (domain/proxy) and now it works.




回答3:


I had same problem.

The problem is 'domain' in file settings.xml

<proxy>
 ...
  <username>DOMAIN\user</username>
 ...
</proxy>

DOMAIN is optional if you launch maven in Microsoft Systems but it is mandatory if you launch maven in UNIX systems with domain authentication and remapped user (user home is in /home/DOMAIN/user), I found this trick in empiric way.




回答4:


Something that happened to me was that when I installed Maven, it added proxy information in ~/.m2/settings.xml. I don't have a proxy, so I'm not sure where it came from, but that prevented me from being able to download anything. After removing the proxy info, downloads were successful.




回答5:


If you need a proxy server section, but want to connect to a repository on the intranet you can add an exclusion list: <nonProxyHosts>localhost|repoHost<nonProxyHosts>



来源:https://stackoverflow.com/questions/2499045/maven-error-unable-to-get-resource-server-redirected-too-many-times

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!