5
votes

I just deployed a Maven multi module project to Nexus with a SNAPSHOT version.

The deployed artifacts are present in the Nexus snapshot repository and I can download them directly through the Nexus interface.

However, when I add those artifacts as dependencies to another project, Maven is not able to resolve them.

I get the following error:

Downloading: http://<nexus-url>/nexus/content/groups/public/<groupId>/<artifactId>/1.0-SNAPSHOT/maven-metadata.xml
Downloaded: http://<nexus-url>/nexus/content/groups/public/<groupId>/<artifactId>/1.0-SNAPSHOT/maven-metadata.xml (835 B at 15.1 KB/sec)
Downloading: http://<nexus-url>/nexus/content/groups/public/<groupId>/<artifactId>/1.0-SNAPSHOT/<artifactId>-1.0-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.056s
[INFO] Finished at: Tue Mar 25 17:49:23 IST 2014
[INFO] Final Memory: 11M/234M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project my-project: Co
uld not resolve dependencies for project com.example:my-project:jar:2.0-SNAPSHOT: Could not find artifact <groupId>:<artifactId>:jar:1.0-SNAPSHOT in nexus (http://<nexus-url>/nexus/content/groups/public) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyReso
lutionException

Note that Maven doesn't try to download the file maven-metadata.xml.

Thanks, Mickael


EDIT: Maven DOES download the file maven-metadata.xml. Using -U doesn't help.

It seems that Maven tries to download the artifact without translating SNAPSHOT to an appropriate to timestamp.

2
Your error message was severely truncated I believe.chad
@chad Thanks, I've edited.manash
It looks like it doesn't have the name and group id for the artifact . . . it's looking for <groupId>:<artifactId>:jar:1.0-SNAPSHOT your pom must have a mistake in the declaration of the dependency.chad
You're right! I made a mistake with the type and classifier. It works now. However, I get the same issue with Apache Karaf where I'm trying to add a feature repository that is deployed on Nexus as an XML file.manash

2 Answers

2
votes

Perhaps you need to run the build with -U, which means "force update of dependencies even if you already have resolved them in the last 24 hours".

Without it, maven will only attempt to resolve those snapshots dependencies once a day, which you might have already done, and so you're getting a "cached" response about it not being there.

0
votes

Try this.

In nexus click on your public repositories and go to configuration tab.

  • You will see Ordered Group Repositories and Available Repositories.
  • Move the repository where you deployed your artifacts from Available Repositories to Ordered Group Repositories and then try running the build using -U flag.