【问题标题】:Jenkins upload artifact to nexus plugin not working with Nexus 3Jenkins 将工件上传到无法与 Nexus 3 一起使用的 nexus 插件
【发布时间】:2017-01-04 23:07:25
【问题描述】:

我有一个 Jenkins 项目,它使用 Jenkins 将工件上传到 nexus 插件进行 gradle 构建并将构建工件上传到 Nexus maven 托管存储库。这在我使用 Nexus 2.13 时工作正常 - 但升级到 Nexus 3 后,上传到 Nexus 不再有效。我已经确保我已经配置了 Nexus 3 存储库,就像我的 Nexus 2.13 存储库一样。当我构建我的 Jenkins 项目时,我得到了响应

GroupId: com.company
ArtifactId: hello-world-util
Version: 1.0.0
File: hello-world-util-1.0.0.jar
Repository:companyDevops
Uploading artifact hello-world-util-1.0.0.jar started....
Reason Phrase: Method Not Allowed

<!DOCTYPE html>
<html>
<head>
  <title>405 - Nexus Repository Manager</title>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>

  <!--[if lt IE 9]>
  <script>(new Image).src="http://192.168.99.100:18081/favicon.ico?3.0.1-01"</script>
  <![endif]-->
  <link rel="icon" type="image/png" href="http://192.168.99.100:18081/favicon-32x32.png?3.0.1-01" sizes="32x32">
  <link rel="mask-icon" href="http://192.168.99.100:18081/safari-pinned-tab.svg?3.0.1-01" color="#5bbad5">
  <link rel="icon" type="image/png" href="http://192.168.99.100:18081/favicon-16x16.png?3.0.1-01" sizes="16x16">
  <link rel="shortcut icon" href="http://192.168.99.100:18081/favicon.ico?3.0.1-01">
  <meta name="msapplication-TileImage" content="http://192.168.99.100:18081/mstile-144x144.png?3.0.1-01">
  <meta name="msapplication-TileColor" content="#00a300">

  <link rel="stylesheet" type="text/css" href="http://192.168.99.100:18081/static/css/nexus-content.css?3.0.1-01"/>
</head>
<body>
<div class="nexus-header">
  <a href="http://192.168.99.100:18081">
    <div class="product-logo">
      <img src="http://192.168.99.100:18081/static/images/nexus.png?3.0.1-01"/>
    </div>
    <div class="product-id">
      <div class="product-id__line-1">
        <span class="product-name">Nexus Repository Manager</span>
      </div>
      <div class="product-id__line-2">
        <span class="product-spec">OSS 3.0.1-01</span>
      </div>
    </div>
  </a>
</div>

<div class="nexus-body">
  <div class="content-header">
    <img src="http://192.168.99.100:18081/static/rapture/resources/icons/x32/exclamation.png?3.0.1-01"/>
    <span class="title">Error 405</span>
    <span class="description">Method Not Allowed</span>
  </div>
  <div class="content-body">
    <div class="content-section">
      HTTP method POST is not supported by this URL
    </div>
      </div>
</div>
</body>
</html>

我的 Jenkins nexus 上传配置如下(在 Nexus 2.13 和 3 之间没有改变)

Upload artifact to nexus
Nexus Details
Protocol HTTP
Nexus URL 192.168.99.100:18081
User admin
Password admin123
Credentials com.company
GroupId com.company
ArtifactId hello-world-ui
Version 1.0.0
Packaging jar
Repository companyDevops
File build/libs/hello-world-util-1.0.0.jar

我的 Nexus 3 maven 托管存储库配置如下

Name companyDevops
Format maven2
Type hosted
URL http://192.168.99.100:18081/repository/companyDevops/
Online
Maven 2
Version policy Release
Layout policy Strict
Storage
Blog store default
Strict content type validation X
Hosted
Deployment policy Allow redeploy

不知道为什么我会收到此错误 -我已验证 Nexus 管理员用户有权上传工件 -我已验证允许重新部署已启用

可能会发生什么 - 可能 Jenkins 'upload artifact to nexus' 插件与 Nexus 3 不兼容?

有没有人让这个与 Nexus 3 一起工作?有什么建议吗?

谢谢!

【问题讨论】:

    标签: jenkins nexus


    【解决方案1】:

    此插件不支持 Nexus-3.x,我们正在努力提供将工件上传到 Nexus-3.x 的功能

    【讨论】:

      【解决方案2】:

      Nexus Artifact Uploader 插件现在支持 Nexus-2.x 和 Nexus-3.x。 使用插件版本 2.6 支持 Nexus-3.x https://wiki.jenkins-ci.org/display/JENKINS/Nexus+Artifact+Uploader

      【讨论】:

      • 您能否提供我们可以将工件从 jenkins 上传到 nexus 3 的任何步骤,我正在使用 nexus 3.5.2 我已经安装了您的插件但不清楚如何使用它?不确定组 id 是什么,工件 id 是什么,我需要在 nexus 中创建一个新的存储库吗?我是 nexus 的新手。你能帮我们解决这个问题吗!
      • 这里有什么可以帮助的吗,@AbhiAdr?
      • @KaliyugAntagonist 是的,插件可以工作,您可以在配置 JOB 时在 ADD Build 步骤下选择 Nexus 工件上传器
      • 但它不支持 PyPi 或其他存储库,对吧?
      • 我在 Jenkins 中有 Nexus 3 工件和 Nexus 3 服务器,实际上我必须在管道中将 nexus 版本更改回 nexus2 才能真正让事情正常工作 - 如果插件是可配置的,这将有所帮助。基本上我需要的 URL 是:http://nexus:8081/nexus/content/repositories/maven-snapshots2/ 我需要使用以下设置:NEXUS_PROTOCOL = "http"NEXUS_URL = "nexus:8081/nexus" 最后是NEXUS_REPOSITORY = "maven-snapshots2"`
      【解决方案3】:

      请使用“Nexus Artifact Uploader”,下面是网址,也支持nexus 3。

      https://plugins.jenkins.io/nexus-artifact-uploader

      安装插件后,我们会在构建部分获得nexus artifact uploader。

      【讨论】:

      • 是否有我们可以遵循的任何文章或步骤我是 Jenkins 和 nexus 等工具的新手,我安装了 nexus 3.5.2 如何使用此插件将工件从 Jenkins 上传到 nexus。我已经安装了插件,并且能够在创建作业时在构建步骤下看到它,如何在此处进一步形成。
      猜你喜欢
      • 2017-01-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-12-07
      • 1970-01-01
      • 1970-01-01
      • 2011-05-01
      • 1970-01-01
      相关资源
      最近更新 更多