title: Promoted build plugin deploy artifacts to repository
body: <p>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.</p>
  
  <p>I've set the "promote build when..." to manual approval and the action to "Deploy artifact to Maven Repository" set the repository URL to "<a href="http://example.com:8081/nexus/content/repositories/releases/" rel="noreferrer">http://example.com:8081/nexus/content/repositories/releases/</a>" and the repo id to "release".
  However when the approval is triggered we get the following stack trace:</p>
  
  <blockquote>
    <p>[INFO] Deployment in <a href="http://example.com:8081/nexus/content/repositories/releases/" rel="noreferrer">http://example.com:8081/nexus/content/repositories/releases/</a> (id=release,uniqueVersion=true)
    Deploying the main artifact artifactid-1.0.2.pom
    Uploading: <a href="http://example.com:8081/nexus/content/repositories/releases/groupid/artifactid/1.0.2/artifactid-1.0.2.pom" rel="noreferrer">http://example.com:8081/nexus/content/repositories/releases/groupid/artifactid/1.0.2/artifactid-1.0.2.pom</a>
    ERROR: Failed to deploy artifacts: Could not transfer artifact groupid:artifactid:pom:1.0.2 from/to release (<a href="http://example.com:8081/nexus/content/repositories/releases/" rel="noreferrer">http://example.com:8081/nexus/content/repositories/releases/</a>): Failed to transfer file: <a href="http://example.com:8081/nexus/content/repositories/releases/groupid/artifactid/1.0.2/artifactid-1.0.2.pom" rel="noreferrer">http://example.com:8081/nexus/content/repositories/releases/groupid/artifactid/1.0.2/artifactid-1.0.2.pom</a>. 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 (<a href="http://example.com:8081/nexus/content/repositories/releases/" rel="noreferrer">http://example.com:8081/nexus/content/repositories/releases/</a>): Failed to transfer file: <a href="http://example.com:8081/nexus/content/repositories/releases/groupid/artifactid/1.0.2/artifactid-1.0.2.pom" rel="noreferrer">http://example.com:8081/nexus/content/repositories/releases/groupid/artifactid/1.0.2/artifactid-1.0.2.pom</a>. 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)</p>
  </blockquote>
  
  <p>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.</p>
  
  <p>How does the promoted builds plugin determine the authentication details for deploy?</p>