Reputation: 3829
I have set up nexus on a server and now I would like to ensure that my local machine only uses nexus to get any dependencies and never goes to its local .m2 directory.
Is there a recommended way to do this and in fact is this even recommended at all?
Thanks
Upvotes: 7
Views: 8543
Reputation: 237
This question still comes to the top of Google results when looking for this topic. So I'm going to propose my solution.
What you want to do is change the localRepository value in your settings.xml to another directory. Or use the cmd option -Dmaven.repo.local=<other_folder>
That way you force Maven to redownload everything without having to delete or purge your local repo.
This is 10 years late, and I'm guessing that you already fixed your issue. But as I said, Google still sends people here.
Upvotes: 0
Reputation: 184
You always have to use your local .m2 directory, because otherwise Java would not be able to put the JARs to classpath.
If you always want to update your local repositories with the versions from e.g. Nexus, then use "mvn -U" or "mvn --update-snapshots" which "Forces a check for updated releases and snapshots on remote repositories" according to http://books.sonatype.com/mvnref-book/reference/running-sect-options.html.
Otherwise remote repositories are only checked daily if there is already an artifact within local repository.
Upvotes: 9