0
votes

I am trying to build private maven artifacts on some VPS running OpenShift Origin. I have set up a local nexus service (http://nexus-ci.apps.intrinsic.world/content/groups/public/) and already succeeded in (automatically) using another instance of Jenkins to build some jars and upload them there.

Now I want this other separate Jenkins instance (so no common repository) to simply use nexus to find all its maven dependencies. In order to achieve that, I have tried to provide the following settings.xml document to Jenkins' main config, to no avail:

<?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">
  <profiles>
    <profile>
      <id>nexus</id>
      <activation>
        <property>
          <name>nexus</name>
          <value/>
        </property>
      </activation>
      <repositories>
        <repository>
          <id>nexus-repository</id>
          <url>http://nexus-ci.apps.intrinsic.world/content/groups/public/</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <id>nexus-plugin-repository</id>
          <url>http://nexus-ci.apps.intrinsic.world/content/groups/public/</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>
  </profiles>
  <activeProfiles>
    <activeProfile>nexus</activeProfile>
  </activeProfiles>
</settings>

What am I missing?

2
Your "local" Nexus with "private" artifacts is publicly visible - is that intentional?Harald Wellmann
Good catch, not paranoïd about it. Enough not to be "officially" public ;-)candide

2 Answers

1
votes

If you want all dependencies to be loaded via your Nexus, you should use a mirror definition instead of additional repositories:

<mirror>
  <id>nexus</id>
  <mirrorOf>*</mirrorOf>
  <name>Nexus</name>
  <url>http://nexus-ci.apps.intrinsic.world/content/groups/public/</url>
</mirror>
0
votes

You should use a group, override central and configure the mirror. Details with an example are in the documentation.

Also you might want to look at using the config-file-provider-plugin. I recorded some videos about the jenkins setup in the Tips from the Trenches video series.