首页 文章

在Jenkins中使用nexus解析工件

提问于
浏览
0

我正在尝试在运行OpenShift Origin的某些VPS上构建私有maven工件 . 我已经设置了一个本地nexus服务(http://nexus-ci.apps.intrinsic.world/content/groups/public/)并且已经成功(自动)使用另一个Jenkins实例来构建一些jar并将其上传到那里 .

现在我想要另一个单独的Jenkins实例(所以没有公共存储库)来简单地使用nexus来查找它的所有maven依赖项 . 为了实现这一点,我试图向Jenkins的主配置提供以下 settings.xml 文档,但无济于事:

<?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>

我错过了什么?

2 回答

  • 0

    您应该使用组,覆盖中心并配置镜像 . 举例的详细信息是in the documentation .

    您也可以查看使用config-file-provider-plugin . 我在Tips from the Trenches video series.录制了一些关于jenkins设置的视频

  • 0

    如果您希望通过Nexus加载所有依赖项,则应使用镜像定义而不是其他存储库:

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

相关问题