I'm sure that if you only talk about storing binaries from "mvn deploy
" both will do fine.
We use Artifactory very extensively with all upgrades along the way. Lots of projects, numerous snapshots deployed and external repos proxied. Not a single problem. I find it hard to explain how other people experience issues with its DB, indexing or anything else. Nothing like that ever happened to us. Also, Artifactory allows to store data on a disk and only use a DB for storing metadata, it is quite flexible (see more here).
What makes those applications very different is their approach towards integration with other build tools and technologies. Nexus and Sonatype are pretty much locked on Maven and m2eclipse. They ignore anything else and only recently started to work on their own proprietary Hudson integration (see their Maven 3 webinar).
EDIT: This is not true anymore as of 2017 Nexus gives a much larger support for other build tools End of Edit
Artifactory provides an awesome Hudson, TeamCity and Bamboo integration, and Gradle / Ivy support. So while Nexus gives you nothing once you step out of Sonatype "comfort zone" (Maven, m2eclipse), Artifactory embraces and collaborates with all major build tools.
In fact, being able to deploy build artifacts from Hudson, when job has finished, and not by "mvn deploy
" is a huge difference: Artifactory Hudson plugin makes an atomic-like deploy of all artifacts at once, only when a build job finished successfully. "mvn deploy
" runs after each module and can deploy a partial set of artifacts if a build job fails in the middle. Deploying from Maven on module completion and not from a build server on job completion is really a bad thing to do.
As you see, Artifactory thinks "outside the box" while Nexus thinks "inside the box" and only cares about Maven and Maven artifacts.
Something else that makes Artifactory more accessible is their cloud-based Artifactory Online solution. For about $80 a month you have your own Artifactory instance, no need to dedicate any server for it.
Artifactory has a simple and straightforward REST API, don't know how it works for Nexus.
Edit Nexus has also a REST API that you can use easily as well.
To summarize, for basic storage of Maven artifacts I think both are fine. But while Nexus stops there being strictly a "Maven repository manager", Artifactory goes on and on, being a general "Binaries storage" for binaries of any kind, from any build tool and CI server.
Nexus has several type of repositories: hosted repositories (those that really store maven artifacts), proxy repositories (that redirect traffic to other remote repositories when an artifact is requested), virtual repositories (a mere adapter of maven1 repositories [out of the scope of this question]). you can also create repository groups that can serve artifacts from any of its aggregates (the public
repository is one of these).
In addition, nexus divides their repositories according to its publishing policy into snapshots and releases. The former stores only snapshot artifacts; while the latter, in theory, can store both snapshots and releases, but it actually behaves buggy when the repo is very big and contains snapshots.
In order to host your artifacts you need to:
First: Divide your local repository into two: one containing the snapshots, and another containing the releases. Nexus repository convertion tool will help you if your repo is very big:
<dependency>
<groupId>org.sonatype.nexus.tools</groupId>
<artifactId>nexus-repository-conversion-tool</artifactId>
<version>1.8.0.1</version>
<classifier>cli</classifier>
</dependency>
Once downlaoded you can just execute java -jar nexus-repository-conversion-tool-1.8.0.1-cli.jar -rSource -oTarget
where Source
is the directory that contains the local repository to move to nexus, and Target
is an existing, empty and writable directory where the convertion tool will leave the splitted repositories. Provided that source directory is repository
and Target is temp
, it will create temp/repository-snapshots
and temp/repository-releases
directories.
Second: move your splitted repos to nexus. And leave them in ${NEXUS_HOME}/sonatype-work/nexus/storage
, or wherever your nexus installation is configured to store the repositories.
Third: create two hosted repositories with the same id as the repos you moved in the second step. (in the example repository-snapshots
and repository-releases
)
If your repo would only contained releases, your solution could have worked, but you will have commited another mistake. Although nexus stores artifacts for every repository, the storage of those that aren't hosted repos is just for caching purposes (as in the case of the public
repository), you would have to copied your contents to a hosted one in order to work.
Best Answer
I had the same problem: it happens, i believe, when the local m2e index becomes corrupted, mainly when an Eclipse/VM crash occurs. I have found that, for my configuration, the index resides in .m2/repository/.cache/m2e
I closed Eclipse, deleted all the subfolders inside that folder, and I fixed the problem.
I'm sure that it suffice to seek the file(s) where lies the index, but deleting the whole directory worked fine for me.
Ensure, before deleting, that your remote maven repo index is not corrupt (right-click repair Index in the public repository of Nexus).