We have a Jenkins Maven build running on a Windows slave which runs maven package on every commit. I'm trying to use the promoted build plugin to deploy promoted builds to a nexus release repository.
I've set the "promote build when..." to manual approval and the action to "Deploy artifact to Maven Repository" set the repository URL to "http://example.com:8081/nexus/content/repositories/releases/" and the repo id to "release". However when the approval is triggered we get the following stack trace:
[INFO] Deployment in http://example.com:8081/nexus/content/repositories/releases/ (id=release,uniqueVersion=true) Deploying the main artifact artifactid-1.0.2.pom Uploading: http://example.com:8081/nexus/content/repositories/releases/groupid/artifactid/1.0.2/artifactid-1.0.2.pom ERROR: Failed to deploy artifacts: Could not transfer artifact groupid:artifactid:pom:1.0.2 from/to release (http://example.com:8081/nexus/content/repositories/releases/): Failed to transfer file: http://example.com:8081/nexus/content/repositories/releases/groupid/artifactid/1.0.2/artifactid-1.0.2.pom. Return code is: 401, ReasonPhrase: Unauthorized. org.apache.maven.artifact.deployer.ArtifactDeploymentException: Failed to deploy artifacts: Could not transfer artifact groupid:artifactid:pom:1.0.2 from/to release (http://example.com:8081/nexus/content/repositories/releases/): Failed to transfer file: http://example.com:8081/nexus/content/repositories/releases/groupid/artifactid/1.0.2/artifactid-1.0.2.pom. Return code is: 401, ReasonPhrase: Unauthorized. at org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:143) at hudson.maven.reporters.MavenArtifactRecord.deploy(MavenArtifactRecord.java:193) at hudson.maven.RedeployPublisher.perform(RedeployPublisher.java:176) at hudson.plugins.promoted_builds.Promotion$RunnerImpl.build(Promotion.java:282) at hudson.plugins.promoted_builds.Promotion$RunnerImpl.doRun(Promotion.java:224) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:533) at hudson.model.Run.execute(Run.java:1740) at hudson.model.Run.run(Run.java:1678) at hudson.plugins.promoted_builds.Promotion.run(Promotion.java:174) at hudson.model.ResourceController.execute(ResourceController.java:89) at hudson.model.Executor.run(Executor.java:240)
If I change the promotion action to trigger maven deploy the build is re-run and the deploy target works as expected, if I add a git publisher this also fails on authentication. Both operations succeed if carried out locally by the user running Jenkins.
How does the promoted builds plugin determine the authentication details for deploy?