Question

I have used Sonatype Nexus repository management and my requirements are as follows:

  1. First of all my Custom Nexus Repo should come into picture, maven should first check there
  2. If some jars are not there then it should go to Maven Central
  3. For those jars that are not even in Maven Central like(Eigenbase-XOM) it should go to PentaHo

But things are not working for me, EigenBase XOM is missing artifact error is shown, as it is not getting downloaded

It would be a great help if anybody can help. Please let me know where I am wrong?

<?xml version="1.0" encoding="UTF-8"?>
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.1.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <mirrors>
    <mirror>
      <id>MyRepo</id>
      <mirrorOf>*</mirrorOf>
      <url>http://localhost:port/nexus/content/groups/public</url>
    </mirror>
  </mirrors>
  <profiles>
   <profile>
      <id>MyRepo</id>
     <repositories>
        <repository>
          <id>central</id>
          <url>http://central</url>
          <releases><enabled>true</enabled></releases>
          <snapshots><enabled>true</enabled></snapshots>
        </repository>
        <repository>
        <id>pentaho-releases</id>
        <url>http://repository.pentaho.org/artifactory/repo/</url>
               </repository>
     </repositories>
         <pluginRepositories>
        <pluginRepository>
          <id>central</id>
           <url>http://central</url>
            </pluginRepository>
      </pluginRepositories>
</profile>
  <activeProfiles>
    <activeProfile>MyRepo</activeProfile>
  </activeProfiles>
</settings>
Was it helpful?

Solution 2

Just use the simple setup of a public group and add the proxy repositories to the group. More details can be found in the Nexus book chapter on Maven usage.

The order of the repositories in the group list can control the resolving order as you desire.

OTHER TIPS

@Manfred Moser: Yes you are right. After searching on net I got the same trick.

A more detailed answer is: 1) Create a new repository. 2) Add that repository to the a repository group 3) You can also change the repository resolving order

Sample Setting XML is: {

    <mirrors>
    <mirror>
      <!--This sends everything else to /public -->
      <id>MyRepo</id>
      <mirrorOf>*</mirrorOf>
      <url>http://localhost:port/nexus/content/groups/public</url>
    </mirror>
  </mirrors>
  <profiles>
   <profile>
      <id>MyRepo</id>
      <!--Enable snapshots for the built in central repo to direct -->
      <!--all requests to MyRepo via the mirror -->
      <repositories>
        <repository>
          <id>central</id>
          <url>http://central</url>
          <releases><enabled>true</enabled></releases>
          <snapshots><enabled>true</enabled></snapshots>
        </repository>
     </repositories>
     <pluginRepositories>
        <pluginRepository>
          <id>central</id>
          <url>http://central</url>
          <releases><enabled>true</enabled></releases>
          <snapshots><enabled>true</enabled></snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>
    </profiles>
  <activeProfiles>
    <activeProfile>MyRepo</activeProfile>
</activeProfiles>
</settings>

}

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top