I have a few personal projects and few corporate ones. The corporate projects use a mirrored corporate SVN repo for maven dependencies. I would like to configure my settings.xml in such a way that the dependencies are first checked against my corporate mirror. Only when the dependencies are not found here (for my personal projects) then it should check against the original "central" repo that is mirrored by my corporate repo. Is this possible. Below is a snippet of what I have right now but it doesn't hit the "central" repo when required. Thanks.
<servers>
<server>
<id>central-mirror</id>
<username>myusername</username>
<password>mypassword</password>
<filePermissions>664</filePermissions>
<directoryPermissions>775</directoryPermissions>
<configuration></configuration>
</server>
</servers>
<mirrors>
<mirror>
<id>central-mirror</id>
<url>https://url.to.my/mirror</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
<proxies>
<proxy>
<id>proxy</id>
<active>true</active>
<protocol>http</protocol>
<host>my.corporate.proxy</host>
<port>8080</port>
<nonProxyHosts>localhost|*.my.corporate.proxy</nonProxyHosts>
</proxy>
Ok after some trial and error I finally figured out how to do this. I am hoping this will help out many others. Below is my updated settings.xml. For any project in my Eclipse, maven first tries to download libs from my corporate mirror. Only if it can't find it there, it gets it from central repo.
<servers>
<server>
<id>central-mirror</id>
<username>myusername</username>
<password>mypassword</password>
<filePermissions>664</filePermissions>
<directoryPermissions>775</directoryPermissions>
<configuration></configuration>
</server>
</servers>
<mirrors>
<mirror>
<id>central-mirror</id>
<url>https://url.to.my/mirror</url>
<mirrorOf>*,!central</mirrorOf>
</mirror>
</mirrors>
<proxies>
<proxy>
<id>proxy</id>
<active>true</active>
<protocol>http</protocol>
<host>my.corporate.proxy</host>
<port>8080</port>
<nonProxyHosts>localhost|*.my.corporate.proxy</nonProxyHosts>
</proxy>
<profiles>
<profile>
<activeByDefault>true</activeByDefault>
<repositories>
<repository>
<id>central-mirror</id>
<url>https://url.to.my/mirror</url>
</repository>
</repositories>
</profile>
</profiles
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