Roger Alkins
Roger Alkins

Reputation: 145

How to access more than one repo in maven?

Can someone clarify for me how I can access more than one repo in maven? I have a corporate mirror that is configured in settings.yml and it takes in all requests The problem is I need a jar file that is not in the mirror? If I switch it I lose all the other jars I need? Can someone explain what I need to do? If I add additional mirrors it only uses one of them at a time ... Every time I compile mvn clean install it just checks the one mirror and complains.

<mirrors>
    <mirror> <!--Send all requests to the public group -->
        <id>nexus</id>
        <mirrorOf>*</mirrorOf>
        <url>http://sl- quality.mycompany.com/nexus/content/groups/public/</url>
    <name>UK Central</name>
    <url>http://uk.maven.org/maven2</url>
    <mirrorOf>central</mirrorOf>-->
    </mirror>
    <mirror> <!--Send all requests to the public group -->
        <id>ksqlDB</id>
        <mirrorOf>*</mirrorOf>
        <url>https://ksqldb-maven.s3.amazonaws.com/maven/</url>
    </mirror>
     <mirror> <!--Send all requests to the public group -->
        <id>confluent</id>
        <mirrorOf>*</mirrorOf>
        <url>https://jenkins-confluent-packages-beta-maven.s3.amazonaws.com/6.1.0-beta200715032424/1/maven/</url>
    </mirror>
</mirrors>
 <activeProfiles>
 <!--make the profile active all the time -->
    <activeProfile>nexus</activeProfile>
</activeProfiles>
<profiles>
    <profile>
        <id>nexus</id>
       <activation>
            <activeByDefault>true</activeByDefault>
        </activation>
        <repositories>
            <repository>

UPDATE:

<mirrors>

    <mirror> <!--Send all requests to the public group -->
        <id>nexus</id>
        <mirrorOf>!ksqlDB, !confluent, *</mirrorOf>
        <url>http://sl-quality.mycompany.com/etc</url>
        <!--<id>UK</id>
        <name>UK Central</name>
        <url>http://uk.maven.org/maven2</url>
        <mirrorOf>central</mirrorOf>-->
        </mirror>
    <mirror> <!--Send all requests to the public group -->
        <id>ksqlDB</id>
        <mirrorOf>!nexus,*</mirrorOf>
        <url>https://ksqldb-maven.s3.amazonaws.com/maven/</url>
   </mirror>
   <mirror> <!--Send all requests to the public group -->
       <id>confluent</id>
       <mirrorOf>!nexus, !ksqlDB, *</mirrorOf>
       <url>https://jenkins-confluent-packages-beta-maven.s3.amazonaws.com/6.1.0-beta200715032424/1/maven/</url>
  </mirror>

pom.xml

 <repositories>
       <!-- jhipster-needle-maven-repository -->
         <repository>
            <id>ksqlDB</id>
            <name>ksqlDB</name>
            <url>https://ksqldb-maven.s3.amazonaws.com/maven/</url>
        </repository>
        <repository>
            <id>confluent</id>
            <name>Confluent</name>
            <url>https://jenkins-confluent-packages-beta-maven.s3.amazonaws.com/6.1.0-beta200715032424/1/maven/</url>
        </repository>
    </repositories>

    <pluginRepositories>
        <!-- jhipster-needle-maven-plugin-repository -->
        <pluginRepository>
            <id>ksqlDB</id>
            <url>https://ksqldb-maven.s3.amazonaws.com/maven/</url>
        </pluginRepository>
        <pluginRepository>
            <id>confluent</id>
            <url>https://jenkins-confluent-packages-beta-maven.s3.amazonaws.com/6.1.0-beta200715032424/1/maven/</url>
        </pluginRepository>
    </pluginRepositories>

 <ksqldb.version>0.11.0</ksqldb.version>
        <!-- Maven properties for compilation -->
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

// This is all to get just

<dependency>
      <groupId>io.confluent.ksql</groupId>
      <artifactId>ksqldb-api-client</artifactId>
       <version>${ksqldb.version}</version>
</dependency>

Upvotes: 1

Views: 261

Answers (1)

Michael
Michael

Reputation: 44250

It's because you've specified these things are a mirror of everything.

<mirrorOf>*</mirrorOf>

You shouldn't have 3 mirrors which are all a mirror of everything. That doesn't make any sense.

You should make use of some exclusions. In this case, this means "everything except someRepo".

<mirrorOf>*,!someRepo</mirrorOf>

See Guide to Mirror Settings

Upvotes: 1

Related Questions