Hi,
I am trying to upload artifacts via PUT requests to a hosted Maven repository of a Nexus 3.9 instance. But at least one upload always fails. There is nothing in the logs that points to an exception or to a revocation.
I am basically doing the first proposed solution explained on this support page:
https://support.sonatype.com/hc/en-us/articles/115006744008-How-can-I-programmatically-upload-an-artifact-into-Nexus-3-The files that I try to upload look like this:
acme-0.0.1-26.pom
acme-0.0.1-26.jar
acme-0.0.1-26-javadoc.jar
acme-0.0.1-26-sources.jar
The POM is always uploaded first, then the JARs. For the upload, I am using PowerShell, but I also tried with cURL and my IDEs HTTP client. Most of the time, the 'acme-0.0.1-26-javadoc.jar' fails to upload for no clear reason. I am just getting a 401 response or, when behind a reverse proxy, a 502 Bad Gateway response.
Here is what I do in PowerShell to upload the files:
$credential = ...
$nexusRoot = "http://somehost/nexus/repository/maven-releases/com/acme/acme/0.0.1-26"
Get-ChildItem -Path . -Filter *.pom | ForEach-Object {
Invoke-RestMethod -Method Put -Uri "${nexusRoot}/$($_.Name)" -Credential $credential -ContentType "application/xml" -Infile $_.FullName
}
Get-ChildItem -Path . -Filter *.jar | ForEach-Object {
Invoke-RestMethod -Method Put -Uri "${nexusRoot}/$($_.Name)" -Credential $credential -ContentType "application/java-archive" -Infile $_.FullName
} I don't understand why this fails almost all the time for the 'javadoc' classified file, but not for the other files. It feels unreliable.
Is there a way to find out whats wrong? Am I doing something wrong? I'd appreciate any idea or hint.
Kind regards,
Robert