I have the following in settings.xml
<mirrors>
<mirror>
<id>paid-jars</id>
<name>jars with license</name>
<url>http://url:8081/nexus/content/repositories/paidjars/</url>
<mirrorOf>!central</mirrorOf>
</mirror>
<mirror>
<id>Org-central</id>
<name>mirror of central</name>
<url>http://url:8081/nexus/content/repositories/central/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
In pom.xml I have two jars
- apache-commons.jar (which I assumes to be downloaded from central)
- licensed.jar (which I assume to be downloaded from paid-jars)
But when I run maven clean install
it tries to download licensed.jar from Org-central.
How can I make it use paid-jars to download? Is it possible first it goes to Org-central and if fails it tries at paid-jars? If so, how? I don't want to put repo entries in pom.xml
Settings.xml
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<proxies>
<proxy>
<id>Proxy</id>
<active>true</active>
<protocol>http</protocol>
<username>username</username>
<password>******</password>
<host>host.url</host>
<port>8080</port>
<nonProxyHosts>local.net|internal.com</nonProxyHosts>
</proxy>
</proxies>
<mirrors>
<mirror>
<id>paid-jars</id>
<name>jars with license</name>
<url>http://url:8081/nexus/content/repositories/paidjars/</url>
<mirrorOf>!central</mirrorOf>
</mirror>
<mirror>
<id>Org-central</id>
<name>mirror of central</name>
<url>http://url:8081/nexus/content/repositories/central/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
<profiles>
<profile>
<id>compiler</id>
<properties>
<JAVA_1_7_HOME>C:Program Files (x86)Javajdk1.7.0_51in</JAVA_1_7_HOME>
</properties>
</profile>
</profiles>
</settings>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…