How can I configure Maven to use several local repositories while building one package?
I have two folders, ~/.m2/repository
(default for Maven) and ~/local_repo_tmp
and want to implement following:
If Maven can't find something inside of ~/local_repo_tmp
it has to download it from remote repository and put to ~/.m2/repository
, otherwise it has to put the copy from ~/local_repo_tmp
to ~/.m2/repository
.
I've tried to add following to my pom.xml
:
<repositories>
<repository>
<id>firstrepo</id>
<name>repo</name>
<url>file:///Users/myusername/local_repo_tmp</url>
</repository>
</repositories>
But it seems that it doesn't work, because it takes same time for following:
- When build my project when both
~/local_repo_tmp
and~/.m2/repository
are empty - When
~/local_repo_tmp
is copy of~/.m2/repository
previous state, but~/.m2/repository
is empty
What do I do wrong ?