In maven settings, there is an entity which refers the local repository:
<localRepository>~/.m2/repository</localRepository>
When I add another one, like this:
<localRepository>~/another/place</localRepository>
it raises Duplicated tag
error.
Can I have multiple local repository or maybe add another direcotry to the local repository?
EDIT This idea seems a possible answer, too:
mvn -Dmaven.repo.local=/path/to/repo
Yes you can have and you can do it in your POM.xml
itself. Below is an example.
<project>
...
<repositories>
<repository>
<id>firstrepo</id>
<name>repo</name>
<url>http://myrepo.my</url>
</repository>
<repository>
<id>secondrepo</id>
<name>repo2</name>
<url>http://myrepo.yours</url>
</repository>
</repositories>
...
</project>
Second Method by creating profile
in your settings.xml
For multiple local repositories you can have multiple settings.xml
file.
In the command line specify alternate path using
mvn -Dmaven.repo.local=/path/to/repo
For more information you can check this link. Hope it helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With