Tuesday, August 2, 2011

Maven 3 and Nexus Incompatibility

Just a quick post on something I came across today.  We are in the process of upgrading to Maven 3 and everything worked fine on my local machine and even on our build server using Continuum.  However, when attempting to download the artifact generated as part of the build process I was getting an error about the artifact not being found.  I looked in Nexus and the artifact was there and the build results showed that it had indeed been deployed.

After a little searching I found the problem to be caused by a change in Maven 3 during the creation of the metadata that gets deployed to the repository.  Maven 3 has added some more information in the metadata than Maven 2.  In my case the version of Nexus we are using (1.6) has some issues with this change and doesn't correctly notify clients of the version.

Here are three possible fixes:
1. Upgrade to Nexus version where the issue has been fixed. (http://goo.gl/AVgbT)
2. Stay at an existing version of Nexus but replace a library with a patched version (http://goo.gl/AVgbT see Maven 3 Metadata section for link)
3. Add the following parameter -Dmaven.metadata.legacy=true to your execution of mvn deploy. (http://goo.gl/7ZUix)

I went with the 3rd option because it was the least intrusive and now all is well.

No comments:

Post a Comment