2
votes

We have been building MuleESB using Maven. Everything has been working fine.

However, we recently added Sonatype Nexus as a repository manager.

Now, building MuleESB using Maven which is now configured to mirror our internal public Nexus URL, many transitive dependencies are not found and the build fails.

I have to go and look which transitive dependency is not found, find which public repository it sits on by looking at the pom files, and then add that as a proxied repository on Nexus. I am repeating this for every unresolved dependency.

Note that I have added the mulesoft releases and snapshot repository. It appears to be the transitive dependencies which are found in other repositories (not the Mulesoft one) which are failing.

What is the best/easiest way to make sure all required repositories are added to our Sonatype Nexus repository?

--- EDIT ---- So far I have found that if I add the following repositories to Nexus, I can build Mule ESB Community Edition as all dependencies are found.

3
When you build your own nexus repository then you need to ensure all the needed jars are available in that repository. If yours is a Mule Enterprise then you can request Mulesoft to provide a snapshot of their repository(based non your liscense) . There is not short cut other than adding all your needed dependencies to your nexus repository if you are going to use that alone going forwardNaveen Raj
Can you just proxy mule public and enterprise repository and allow to download from there ? Here you found the 4 repos docs.mulesoft.com/mule-user-guide/v/3.6/…Mauro Rocco
We are not using Enterprise, so don't have a user name and password to access Mulesofts enterprise repositorydleerob

3 Answers

2
votes

You are following the right process:

  • Identify the repositories you need access to
  • Create a proxy repository for each one, make sure to set the appropriate policy (snapshot vs release), for proxying groups make sure to create two proxy repositories with the same URL and different policy if it has mixed content
  • Add the repositories to the group through which you access the Nexus repository manager, keep in mind that the order in the group is important, keep large, performant ones as well as your internal repositories at the top

In your list you can probably remove the artifactory repository since the artifacts will be in the other repositories. Also the maven.org (Central Repository) is already preconfigured in the Nexus Repository Manager so you probably don't have to add it.

It is best to add one repo at a time and try a build either from a fresh install (deleted local Maven repository) or force updates with -U on your mvn invocation.

If you need more info, you can find all this and more in the documentation.

1
votes
Here is the maven settings I use with Mule development. 
You can use it to figure out how to set up your repository.


<?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">
<localRepository>/Users/MuleDev/.m2/repository</localRepository>
  <pluginGroups>
  </pluginGroups>
  <proxies>
  </proxies>
  <servers>
    <server>
      <id>mule-nexus-ee-releases</id> 
      <username>xxx</username>
      <password>xxx</password>
    </server>
     <server>
      <id>mule-ci-releases</id>
      <username>xxxx</username>
      <password>xxx</password>
    </server>
    <server>
      <id>mule-ci-snapshots</id>
      <username>xxxx</username>
      <password>xxx</password>
    </server>
    <server>
      <id>mule-ee-releases</id> 
      <username>xxxx</username>
      <password>xxx</password>
    </server>
    <server>
      <id>mule-ee-snapshots</id> 
      <username>xxxx</username>
      <password>xxxxx</password>
    </server>
    <server>
      <id>mule-ee-thirdparty</id> 
      <username>xxxxx</username>
      <password>xxxx</password>
    </server>
    <server>
      <id>mule-ee-dependencies</id> 
      <username>xxxx</username>
      <password>xxxx</password>
    </server>
    <server>
      <id>mule-third-party</id> 
      <username>xxxx</username>
      <password>xxxx</password>
    </server>    
  </servers>
  <mirrors>
  </mirrors>
  <profiles>
    <profile>
      <id>default-profile</id>
      <repositories>
          <repository>
            <id>jboss</id>
            <url>https://repository.jboss.org/nexus/content/repositories/</url>
            <releases>
              <enabled>true</enabled>
            </releases>
            <snapshots>
              <enabled>true</enabled>
            </snapshots>
          </repository>
        <repository>
          <id>mule-releases</id>
          <name>Mule Releases Repository</name>
          <url>http://repository.mulesoft.org/releases/</url>
        </repository>
        <repository>
          <id>mule-ee-releases</id>
          <name>MuleEE Releases Repository</name>
          <url>https://repository-master.mulesoft.org/nexus/content/repositories/ci-releases/</url>
          <releases>
            <enabled>true</enabled>
          </releases>
        </repository>
        <repository>
          <id>mule-ee-thirdparty</id>
          <name>Local repository for thirdparty</name>
          <url>https://repository-master.mulesoft.org/nexus/content/repositories/ext-releases/</url>
          <releases>
            <enabled>true</enabled>
          </releases>
        </repository>
        <repository>
          <id>mule-ee-dependencies</id>
          <name>Mule EE Dependencies</name>
          <url>https://repository-master.mulesoft.org/nexus/content/groups/mule-ee-dependencies/</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </repository>
        <repository>
          <id>mule-nexus-ee-releases</id>
          <name>Mule EE Releases Repository</name>
          <url>https://repository.mulesoft.org/nexus-ee/content/repositories/releases-ee/</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </repository>
        <repository>
          <id>mule-nexus-releases</id>
          <name>Mule CE Releases Repository</name>
          <url>https://repository.mulesoft.org/nexus/content/repositories/releases</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </repository>
<repository>
    <id>codehaus-mule-repo</id>
    <name>codehaus-mule-repo</name>
    <url>
      https://repository-master.mulesoft.org/nexus/content/groups/public/
    </url>
    <layout>default</layout>
  </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <id>mule-ee-snapshots</id>
          <url>https://repository-master.mulesoft.org/nexus/content/repositories/ci-snapshots/</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
          <layout>default</layout>
        </pluginRepository>

        <pluginRepository>
          <id>mule-ee-releases</id>
          <url>https://repository-master.mulesoft.org/nexus/content/repositories/ci-releases/</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
          <layout>default</layout>
        </pluginRepository>
        <pluginRepository>
          <id>mule-nexus-releases</id>
          <name>Mule CE Releases Repository</name>
          <url>https://repository.mulesoft.org/nexus/content/repositories/releases</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </pluginRepository>
      </pluginRepositories>
      <activation>
          <activeByDefault>true</activeByDefault>
      </activation>
    </profile>
  </profiles>
</settings>
0
votes

The pom used on github for the community development can be used, here's the link

https://github.com/mulesoft/mule/blob/mule-3.x/pom.xml