Jenkins : Jenkins Development Environment with Nexus

How to Set up the Nexus Repository Manager to Build Jenkins

  1. download the latest Nexus war from here.
  2. drop the war in your tomcat instance or some other container.
  3. bring up the Nexus Manager and make sure you configure all of the proxy repositories that Jenkins requires (list below).
  4. replace your ~/.m2/settings.xml file with the version below, editing the Nexus instance address as needed.

This page likely needs to be updated

There was a shift to using Artifactory instead of nexus, a few additional repos are needed to be proxied: http://maven.tmatesoft.com/content/repositories/releases/ and http://bits.netbeans.org/maven2/ when using nexus.


Note

The line <mirrorOf>external:*</mirrorOf> in settings.xml allows nexus to pass-through file:// based url's declared as <repository> elements in several of the plugin poms (and no, it is not best practice to use the source tree as a maven repository!)

Okay, now you can build. It will be the usual slow going if you remove your local maven build repository (default location $HOME/.m2/repository), which is advisable at first, to force nexus to cache all of the Jenkins artifacts.

After your Nexus instance is populated, builds from scratch are very fast.

MAVEN SETTINGS.XML ($HOME/.m2/settings.xml):

<settings>
  <mirrors>
    <mirror>
      <!--This sends everything else to /public -->
      <id>nexus</id>
      <mirrorOf>external:*</mirrorOf>
      <!-- your address may differ: -->
      <url>http://localhost:8080/nexus/content/groups/public</url>
    </mirror>
  </mirrors>
  <profiles>
    <profile>
      <id>nexus</id>
      <!--Enable snapshots for the built in central repo to direct -->
      <!--all requests to nexus 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>
    <!--make the profile active all the time -->
    <activeProfile>nexus</activeProfile>
  </activeProfiles>
</settings>


PROXY REPOSITORY CONFIGURATION:

You only need to add http://maven.jenkins-ci.org/content/repositories/releases/ as a proxy repository with release policy at this stage. The repositories below are proxied from jenkins-ci already so you don't have to.

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

      <id>atlassian</id>
      <name>atlassian</name>
        <url>https://maven.atlassian.com/content/groups/public/</url>
            <id>https://m2proxy.atlassian.com/repository/public</id>
            <url>https://m2proxy.atlassian.com/repository/public</url>
        <repositoryPolicy>RELEASE</repositoryPolicy>

      <id>JA-SIG</id>
      <name>JA-SIG</name>
        <url>http://developer.jasig.org/repo/content/groups/m2-legacy/</url>
        <repositoryPolicy>RELEASE</repositoryPolicy>

      <id>m.g.o-public</id>
      <name>m.g.o-public</name>
        <url>http://maven.glassfish.org/content/groups/public/</url>
        <repositoryPolicy>RELEASE</repositoryPolicy>

      <id>laughing-panda</id>
      <name>laughing-panda</name>
        <url>http://www.laughingpanda.org/maven2/</url>
        <repositoryPolicy>RELEASE</repositoryPolicy>

      <id>jclouds</id>
      <name>jclouds</name>
        <url>http://jclouds.googlecode.com/svn/repo/</url>
        <repositoryPolicy>RELEASE</repositoryPolicy>

      <id>jclouds-snapshots</id>
      <name>jclouds-snapshots</name>
        <url>http://jclouds.rimuhosting.com/maven2/snapshots/</url>
        <repositoryPolicy>SNAPSHOT</repositoryPolicy>

      <id>tek42</id>
      <name>tek42</name>
        <url>http://tek42.com/maven2/</url>
        <repositoryPolicy>RELEASE</repositoryPolicy>

      <id>googlecode.java-xmlbuilder</id>
      <name>googlecode.java-xmlbuilder</name>
        <url>http://java-xmlbuilder.googlecode.com/svn/repo/</url>
        <repositoryPolicy>RELEASE</repositoryPolicy>