How to Set up the Nexus Repository Manager to Build Jenkins
- download the latest Nexus war from here.
- drop the war in your tomcat instance or some other container.
- bring up the Nexus Manager and make sure you configure all of the proxy repositories that Jenkins requires (list below).
- 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>
5 Comments
Unknown User (larrycai)
Excellent wiki for easy follow, and for atlassian, how can I configure below information
<id>https://m2proxy.atlassian.com/repository/public</id>
<url>https://m2proxy.atlassian.com/repository/public</url>
Unknown User (baobaoba)
I followed the instruction here to use Nexus as a mirror I add http://maven.jenkins-ci.org/content/repositories/releases/ as a proxy in my Nexus. I can create the sample project successfully, but when I execute
> mvn package
I got following error:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2:29.845s
[INFO] Finished at: Thu May 23 12:07:24 EDT 2013
[INFO] Final Memory: 14M/122M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project jenkinstest3: Could not resolve dependencies for project rong.jenkinsplugin:jenkinstest
3:hpi:1.0-SNAPSHOT: The following artifacts could not be resolved: org.jenkins-ci.main:jenkins-war:war:1.480.3, org.jenkins-ci.ma
in:jenkins-war:jar:war-for-test:1.480.3, org.netbeans.modules:org-netbeans-insane:jar:RELEASE72: Could not find artifact org.jenk
ins-ci.main:jenkins-war:war:1.480.3 in nexus (http://dsysadm-cm05:8081/nexus/content/groups/public) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
But I have no problem if I don't use Nexus.
Unknown User (guyagl)
I had to add the following to my pom and it works fine.
<dependencies>
<dependency>
<groupId>org.tmatesoft.sqljet</groupId>
<artifactId>sqljet</artifactId>
<version>1.1.6</version>
</dependency>
<dependency>
<groupId>de.regnis.q.sequence</groupId>
<artifactId>sequence-library</artifactId>
<version>1.0.2</version>
</dependency>
</dependencies>
The maven repository at http://maven.jenkins-ci.org/content/repositories/releases/ doesn't include those 2 artifacts for some reason.
Unknown User (remik)
I'm stuck at this point:
then I was such an ignorant and issued:
The command is still running and I hope to be able to successfully invoke sonar:sonar now. Not much more I care about in this particular case case as long as it's not affecting its results.
Point for installing stuff directly from vendor and not necessarily always from OS package repositories.
Unknown User (baymac)
https://repo.jenkins-ci.org/public/
Adding this repository to my nexus proxy repository seems to work.