Jenkins: nexusPublisher does not work and throws exceptions after jenkins-nexus-plugin upgrade

Jenkins ver. 2.138.2
Nexus Repository Manager Version: Sonatype Nexus Repository ManagerOSS 3.13.0-01
Open Source Server: YES
Nexus-Platform-plugin version : 3.3.20180912-170211.be90294

Nexus Repository Manager 3.x has been configured in Jenkins with the right credentials. The test works.
I am trying to publish a maven project to the repository using the nexus-jenkins-plugin (Jenkins Plugins) and it fails with the following exception

Note: We are not using Nexus IQ server. I have just followed instructions for configuring the Nexus Repository Manager Nexus Platform Plugin for Jenkins title " Repository Manager 3 Integration"

Tried using other nexus plugin version too but i get the same error

Usage:

stage (‘Push to nexus’){
nexusPublisher nexusInstanceId: ‘jenkins-nexus’, nexusRepositoryId: ‘maven-releases’, packages: [[$class: ‘MavenPackage’, mavenAssetList: [[classifier: ‘’, extension: ‘’, filePath: ‘./clients/build/libs/xyz.jar’]], mavenCoordinate: [artifactId: ‘kafka-xyz’, groupId: ‘org.apache’, packaging: ‘jar’, version: ‘1.1’]]]
}

Exception:

com.sonatype.nexus.api.dh: Bad Request
at com.sonatype.nexus.api.di.handleResponse(SourceFile:51)
at org.apache.http.impl.client.CloseableHttpClient.execute(SourceFile:223)
at org.apache.http.impl.client.CloseableHttpClient.execute(SourceFile:165)
at com.sonatype.nexus.api.dd.a(SourceFile:84)
Caused: com.sonatype.nexus.api.exception.RepositoryManagerException: Upload component was unsuccessful (400 response from server)
at com.sonatype.nexus.api.dd.a(SourceFile:106)
at com.sonatype.nexus.api.dd.a(SourceFile:87)
at com.sonatype.nexus.api.dd.a(SourceFile:65)
at com.sonatype.nexus.api.dc.upload(SourceFile:152)
at com.sonatype.nexus.api.repository.v3.RepositoryManagerV3Client$upload$1.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:141)
at org.sonatype.nexus.ci.nxrm.v3.ComponentUploaderNxrm3$_upload_closure2.doCall(ComponentUploaderNxrm3.groovy:74)
Caused: java.io.IOException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:83)
at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:105)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:60)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:235)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:247)
at org.sonatype.nexus.ci.nxrm.v3.ComponentUploaderNxrm3$_upload_closure2.doCall(ComponentUploaderNxrm3.groovy:77)
Caused: java.io.IOException: Upload of maven component with GAV [org.apache:kafka-android:1.1] failed
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:83)
at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:105)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:60)

1 Like

OMG I’ve been working on this issue for the past 4 hours.

I am seeing these errors come up whether I did releases or snapshots. I’ve since learned that snapshots are disallowed because it’s a bad habit (?). I couldn’t, however, figure out why this didn’t work with releases. Glad I stumbled upon this.

Taking a peek at the Nexus logs, I am seeing the following, if it helps any:
018-11-06 00:22:43,442-0500 WARN [XXX] *UNKNOWN org.sonatype.nexus.siesta.internal.ValidationErrorsExceptionMapper - (ID XXX) Response: [400] '[ValidationErrorXO{id='*', message='Not authorized for requested path 'path/to/artifact/1.0.0/artifact-1.0.0.war''}]'; mapped from: org.sonatype.nexus.rest.ValidationErrorsException: Not authorized for requested path 'path/to/artifact/1.0.0/artifact-1.0.0.war'

Interesting fact:
I installed the Nexus Artifact Uploader despite its age, and was able to upload to BOTH releases and snapshots just fine.

Looking forward to a fix!!! :frowning:

Edit: I was doing it through a freestyle job.

@danjng @aganesan94 This article may help: Troubleshooting Artifact Deployment Failures – Sonatype Support

I don’t think you’re being affected by this, but there was a bug where the Nexus Platform Plugin wouldn’t work if Nexus was running at a non-root context (i.e. http://localhost:8081/nexus). This has been fixed in the 2018-10-25 version of the Nexus Platform Jenkins Plugin.

Make sure you are using the very latest version of the Nexus Platform Plugin, there were some issues fixed in this area recently.

Environment:
Jenkins 2.93
Nexus platform plugin: 3.3.20181129-003933.77xx
Nexus OSS : 3.14.0-04

I am getting the same error Caused: com.sonatype.nexus.api.exception.RepositoryManagerException: Upload component was unsuccessful (400 response from server)
for latest version of nexus platform plugin as well (3.3.20181129). When I check the nexus logs I could see
WARN [qtp122700367-311] UNKNOWN org.sonatype.nexus.siesta.internal.ValidationErrorsExceptionMapper - (ID 4feefba5-3e2a-4a8f-901d-57beac531323) Response: [400] ‘[ValidationErrorXO{id=’’, message=‘Not authorized for requested path ‘xxx/xxxx/xx/xxxx.jar’’}]’; mapped from: org.sonatype.nexus.rest.ValidationErrorsException: Not authorized for requested path ‘xxx/xxxx/xx/xxxx.jar’
2018-12-07 10:00:00,011+0000 INFO

I am able to deploy it to older version of nexus OSS 2.14.11-01.
Repositories are of maven2 type and allow redeploy