我刚刚在公司代理后面安装了 Nexus 2.2-01。当我直接访问中央存储库时,Maven 正在工作,但当我配置 <mirror>
时,Maven 正在工作。在%M2_HOME%\conf\settings.xml
我不能做一个简单的mvn archetype:create
或mvn clean
.
通过 Nexus Web UI,我可以:
- 中环的“远程浏览”。
- “浏览索引”
- 并且从“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.
最佳答案
啊啊! DNS 问题 - 使用 Maven settings.xml 中的 IP 地址解决了该问题。
关于maven - Nexus 不会从 Central 下载 Artifact ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13927806/