1

I have a Jenkins project that does a gradle build and uploads build artifacts to a Nexus maven hosted repository using the Jenkins upload artifact to nexus plugin. This was working fine when I was using Nexus 2.13 - but after upgrading to Nexus 3, the upload to Nexus is no longer working. I have made sure that I have configured Nexus 3 repository just like my Nexus 2.13 repository. When I build my Jenkins project I get a response

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>

My Jenkins nexus upload is configured like (and this has not changed between Nexus 2.13 and 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

My Nexus 3 maven hosted repository is configured like

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

Not sure why I’m getting this error -I’ve validated that the Nexus admin user has permission to upload artifacts -I’ve validated that allow redeploy is enabled

What might be happening -possibly the Jenkins ‘upload artifact to nexus’ plugin is not compatible with Nexus 3?

Has anyone got this to work with Nexus 3? Any suggestions?

Thanks!

user619804
  • 2,286
  • 12
  • 46
  • 71

3 Answers3

4

Nexus Artifact Uploader plugin now supports Nexus-2.x & Nexus-3.x. Support for Nexus-3.x with plugin version 2.6 https://wiki.jenkins-ci.org/display/JENKINS/Nexus+Artifact+Uploader

Suresh
  • 730
  • 1
  • 5
  • 12
  • 1
    can you please provide any steps where we can upload artifacts from jenkins to nexus 3 , i am using nexus 3.5.2 i have install your plug in but not clear how to use it ? not sure what will be group id ,what will be artifact id , do i need to create a new repository in nexus i am new to nexus . can ypu please help us on this !! – Abhi Adr Nov 02 '17 at 07:58
  • Anything that can help here, @AbhiAdr ? – Kaliyug Antagonist Jan 31 '18 at 12:54
  • @KaliyugAntagonist yea the plugin works you can select Nexus artifacts uploader under ADD Build step while configuring the JOB – Abhi Adr Feb 04 '18 at 15:34
  • But it doesn't support PyPi or other repositories, right ? – Kaliyug Antagonist Feb 05 '18 at 09:42
  • I have Nexus 3 artifact in Jenkins with Nexus 3 server and I actually had to change the nexus version back to nexus2 in the pipeline to actually get things to work - it would help if the plugin was configurable. Basically the URL I needed was: `http://nexus:8081/nexus/content/repositories/maven-snapshots2/` And I needed to use the following settings: `NEXUS_PROTOCOL = "http"`, `NEXUS_URL = "nexus:8081/nexus"` and finally `NEXUS_REPOSITORY` = "maven-snapshots2"` – JGlass Oct 24 '19 at 21:18
1

Please use "Nexus Artifact Uploader", below is the url and also support nexus 3 as well.

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

After the installation of plugin, we would get nexus artifact uploader in build section.

user128364
  • 4,533
  • 3
  • 20
  • 12
  • 2
    is there any article or steps which we can follow i am new to tools like Jenkins and nexus , i have nexus 3.5.2 install how can i upload artifacts from Jenkins to nexus using this plugin. i have install the plugin and able to see it under build step while creating jobs, how to go further form here. – Abhi Adr Oct 29 '17 at 05:27
0

This plugin doesn't support Nexus-3.x, We are working to provide capability uploading artifacts to Nexus-3.x

karthik
  • 16