Visit my.sonatype.com for documentation on Nexus Repository version 2.
Sometimes you'll receive 404 responses when trying to retrieve artifacts from a repository, but you know the artifact is present in Nexus Repository 2.
There are a number of things that can cause this.
NFC ( Not found Cache )
Artifacts may be in the NFC (not found cache). Nexus Repository 2 caches items that are not found in a repository for a period of time specified in the repository's configuration. This is done for performance reasons. Typical reasons for artifacts to be in NFC:
- The repository is a proxy, and an attempt was made to retrieve the artifact before it was available on the remote
- The user has manually restored artifacts into a hosted repository (retrieved them from Nexus Repository 2 trash, for instance).
To clear the cache, have the user right-click on the repository and run "expire cache". Note that group repositories do not have an NFC cache, only repositories contained in groups.
Nexus Repository 2 Configuration Problems
- The hosted/proxy repository is not in the group repository.
- There is a repository route defined which is preventing access to the GAV from the group repository.
The most likely cause is a firewall that has virus scanning turned on. Users can work around this by increasing the HTTP read timeouts in Nexus Repository 2 (either globally or per proxy repository).
Note: Usually the end user is unaware that IT has changed the firewall, so it may not be obvious this could be the real problem.
SNAPSHOT look-ups, or version ranges, or unversioned dependencies (typically plugins) will trigger metadata look-up. If the version referenced by the maven-metadata.xml is not there you will get a 404.
This can usually be fixed by running rebuild metadata on the affected artifact.
Maven POM Dependency Typos
This actually happens more often than you might think - there is a typo in the pom.xml dependency.
Make sure the GAV Maven is looking for matches what is in the repository.
One nice technique is to find the artifact in Nexus Repository 2 UI and paste the XML from the Artifact information panel into the pom.xml. This demonstrates a nice way to avoid this problem in the future.
Maven settings.xml or POM repository config blocks downloads
if you have a mirror or repository defined in your settings.xml or POM, make sure it is configured to allow both releases and snapshots. When Maven decides it should block using a repository to download a release or SNAPSHOT based on this criteria, it does not provide a message indicating this was why.
Diagnose with Nexus Repository 2 using ?describe
Nexus Repository 2 contains a mechanism for diagnosing reasons why an artifact isn't found. You can add "?describe" to the end of an artifact's URL.