我刚刚在公司代理服务器后面安装了Nexus 2.2-01。当我直接进入Central repo时,Maven正在工作,但当我在<mirror>
中配置%M2_HOME%\conf\settings.xml
时,我无法做一个简单的mvn archetype:create
或mvn clean
。
从Nexus网页用户界面我可以:
...但由于某种原因,它不会下载.pom
个文件
Nexus 2.2带有一个用于Central预配置的代理存储库,我可以从Web UI手动浏览索引和下载文件 - 那么为什么它不能在Maven中运行?
我已使用身份验证将默认HTTP代理设置配置为Nexus,但仍会出现以下错误:
[ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:2.4.1
or one of its dependencies could not be resolved:
Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.4.1:
Could not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:2.4.1 from/to nexus
(http://myserver:8081/nexus/content/groups/public):
Failed to transfer file:
http://myserver:8081/nexus/content/groups/public/
org/apache/maven/plugins/maven-clean-plugin/2.4.1/maven-clean-plugin-2.4.1.pom.
Return code is: 504, ReasonPhrase:Gateway Timeout. -> [Help 1]
和
[INFO] Scanning for projects...
Downloading: http://myserver:8081/nexus/content/groups/public/
org/apache/maven/plugins/maven-clean-plugin/2.4.1/maven-clean-plugin-2.4.1.pom
[WARNING] Failed to retrieve plugin descriptor for
org.apache.maven.plugins:maven-clean-plugin:2.4.1:
Plugin org.apache.maven.plugins:maven-clean-plugin:2.4.1
or one of its dependencies could not be resolved:
Failed to read artifact descriptor for
org.apache.maven.plugins:maven-clean-plugin:jar:2.4.1
Downloading: http://myserver:8081/nexus/content/groups/public/
org/codehaus/mojo/maven-metadata.xml
Downloading: http://myserver:8081/nexus/content/groups/public/
org/apache/maven/plugins/maven-metadata.xml
[WARNING] Could not transfer metadata org.apache.maven.plugins/maven-metadata.xml
from/to nexus (http://myserver:8081/nexus/content/groups/public):
Failed to transfer file: http://myserver:8081/nexus/content/groups/public/org/
apache/maven/plugins/maven-metadata.xml.
Return code is: 504, ReasonPhrase:Gateway Timeout.
答案 0 :(得分:2)
哎呀! DNS问题 - 使用maven settings.xml中的IP地址解决了问题。
答案 1 :(得分:0)
另一个答案是正确的,但只是为那些遇到相同问题的人提供了一个注释,但上述答案并没有帮助:检查您的settings.xml代理设置。
答案 2 :(得分:0)
I've seen this error today and the only thing that fixed it was going back to maven 3.2.5 (from 3.3.9)
答案 3 :(得分:0)
为此,似乎
如果在其中正确定义了URL,则可能需要在以下位置打开hosts文件 C:\ Windows \ System32 \ drivers \ etc 并添加如下所示的行,将要连接的服务器映射到其相应的IP ...
11.111.11.11 RepoUrl
这样,您就可以声明名称为RepoUrl的baseurl实际上是IP 11.1。...