Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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

  1. apache-commons.jar (which I assumes to be downloaded from central)
  2. 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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
283 views
Welcome To Ask or Share your Answers For Others

1 Answer

you have to setup mirror

<mirror>
  <id>nexus</id>
  <mirrorOf>*</mirrorOf>
  <url>http://internal/nexus/content/repositories/thirdparty</url>
</mirror>

 <mirror>
  <id>google</id>
  <mirrorOf>google</mirrorOf>
  <url>http://google-maven-repository.googlecode.com/svn/repository</url>
</mirror>   

then add internal & external repo

<profile>
     <id>nexus</id>
  <repositories>

    <repository>
      <id>central</id>
      <name>central</name>
      <url>http://internal/nexus/content/repositories/thirdparty</url>
    </repository>


    <repository>
      <id>google</id>
      <name>google</name>
      <url>http://google-maven-repository.googlecode.com/svn/repository</url>
    </repository>

  </repositories>
</profile>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...