Maven – Nexus won’t download artifacts from Central

configurationinstallationmavennexusPROXY

I've just installed Nexus 2.2-01 behind a corporate proxy. Maven is working when I go direct to the Central repo, but when I configure the <mirror> in %M2_HOME%\conf\settings.xml I can't do a simple mvn archetype:create or mvn clean.

From the Nexus web UI I can:

  • "Browse Remote" in Central.
  • "Browse Index"
  • and from the "Artifact Information" tab where it says "(Not Locally Cached)" I can download the jars
  • and then see the .jar and .jar.sha1 files at "http://127.0.0.1:8081/nexus/content/groups/public/" and "\nexus\sonatype-work\nexus\storage\central"

…but for some reason it does not download the .pom files

Nexus 2.2 came with a proxy repository for Central pre-configured, and I can browse the index and download files manually from the web UI – so why won't it work from Maven?

I have configured Nexus with Default HTTP Proxy Settings with Authentication, but still get errors such as:

[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]

and

[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.

Best Answer

Argh! DNS issue - using the IP address in the maven settings.xml fixed the problem.

Related Topic