The new feature, or better say problem
Since Maven 3.0 (year 2010), while building your project at work, you download some regular dependency, say from your company Nexus repository, you take your notebook home, where you don't have access to that repository, and out of the blue, Maven starts telling you the dependency is not there in your repository, in exactly the same like when you have never downloaded it at all. Still, you can see the dependency artifact in your local repository on the disk. But Maven won't build your project anymore, isn't that a nice new feature? ;)
How to make Maven work again
Luckily, there's a way out, you need to activate so called "legacy mode" for your repository:
a) put "-Dmaven.legacyLocalRepo=true" to your "MAVEN_OPTS" environment vairable,
b) pass an option "-llr / --legacy-local-repository" to the "mvn" command
Alternatively, you can remove "_maven.repositories" (or "_remote.repositories" since a newer Maven version) files from your local repository as the last resort.
And because Maven authors failed to at least introduce a special switch to disable just this academically useful "where did the artifact come from? is that repository still accessible? if no, I will fail the build, even if it is a released artifact version which should never ever change" check, you also get the following uncompromising warning whenever you build with "legacy mode" activated:
Disabling enhanced local repository: using legacy is strongly discouraged to ensure build reproducibility.
Isn't that nice as well? Because what you strive for actually is something like "build reproducibility". And you have no other simple way of achieving this than to activate that "legacy mode" (or playing around with those files which should be considered internal to Maven).
After 9 years...
Many years passed since the described problem arose. It is also evident from various reported bugs and forums that the community (read: people using Maven for serious work) didn't accept the problem and I do think that the majority wants the original (read: sane) Maven behavior back. Still, Maven authors seem to do nothing about it. So this problem keeps confusing, sooner or later, every new Maven adopter.
I wouldn't say a thing if there was at least some progress, but I just cannot see it anywhere after all the years. It's just me guessing, but it feels like one of those situations when one invests lots of work into some cool stuff, but then it turns out not to be so cool. Logic says you should throw the stuff away, but emotions tell you it is your little perfect baby and you won't abandon it that simply.
So in the light of what was said and written (and there are tons of it!), I beg you please, Maven authors, please go and let your baby go in an upcoming Maven version soon. Hopefully not only me will thank you... :)
Some of the reported bugs so far
- MNG-5181 - New resolution from local repository is very confusing (closed as fixed, but didn't fix the confusion, just introduced the "legacy mode" switch)
- MNG-5185 - Improve "missing dependency" error message when _maven.repositories/_remote.repositories contains other repository ids than requested (some tried to close it, but no surprise it was reopened)
- MNG-5883 - Silence unnecessary legacy local repository warning (reopened as well)