Subject: Change default settings
Author: Alex_Raj
In response to: How maven dependency works? or Where do the libraries come from?
Posted on: 10/10/2019 12:52:27 AM
Change default local repository in ${user.home}/.m2/settings.xml
<settings>
...
<localRepository>/path/to/local/repo/</localRepository>
...
</settings>
Add a proxy or mirror to remote repository in ${user.home}/.m2/settings.xml
<settings>
...
<localRepository/>
...
<mirrors>
<mirror>
<id>internal-repository</id>
<name>Maven Repository Manager running on repo.mycompany.com</name>
<url>http://repo.mycompany.com/nexus/content/public</url>
<!--This * sends everything else to the above reposiory -->
<mirrorOf>*</mirrorOf>
</mirror>
</mirrors>
<profiles>
<profile>
...
</profile>
<profile>
...
</profile>
</profiles>
</settings>
Another advanced example
<settings>
...
<mirrors>
<mirror>
<id>internal-repository</id>
<name>Maven Repository Manager running on repo.mycompany.com</name>
<url>http://repo.mycompany.com/proxy</url>
<mirrorOf>external:*,!foo</mirrorOf>
</mirror>
<mirror>
<id>foo-repository</id>
<name>Foo</name>
<url>http://repo.mycompany.com/foo</url>
<mirrorOf>foo</mirrorOf>
</mirror>
</mirrors>
...
</settings>
>
> On 10/10/2019 12:50:57 AM Alex_Raj wrote:
With maven, project finds it's denpedent libraries in the following order:
First locally look at location ${user.home}/.m2/repository/
If not found, then remotely download from http://repo.maven.apache.org/maven2/
References: