Nexus不会从Central下载工件

时间:2012-12-18 06:53:26

标签: maven configuration proxy installation nexus

我刚刚在公司代理服务器后面安装了Nexus 2.2-01。当我直接进入Central repo时,Maven正在工作,但当我在<mirror>中配置%M2_HOME%\conf\settings.xml时,我无法做一个简单的mvn archetype:createmvn clean

从Nexus网页用户界面我可以:

  • 中环的“浏览远程”。
  • “浏览索引”
  • 并从“Artifact Information”选项卡中显示“(非本地缓存)”我可以下载jar
  • 然后在“http://127.0.0.1:8081/nexus/content/groups/public/”和“\ nexus \ sonatype-work \ nexus \ storage \ central中查看.jar​​和.jar.sha1文件“

...但由于某种原因,它不会下载.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.

4 个答案:

答案 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)

为此,似乎

  1. settings.xml中的代理部分引起了问题(您应该删除它们或修复它们)
  2. 您的Maven settings.xml中的URL问题

如果在其中正确定义了URL,则可能需要在以下位置打开hosts文件 C:\ Windows \ System32 \ drivers \ etc 并添加如下所示的行,将要连接的服务器映射到其相应的IP ...

11.111.11.11 RepoUrl

这样,您就可以声明名称为RepoUrl的baseurl实际上是IP 11.1。...