Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-10428

ArtifactDeploymentException on Redeploy when built on slave with private Maven repository

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • None
    • None
    • Jenkins 1.4.2 on Apache Tomcat 6.0.20 using JDK 1.6.0_20-b02/x86 on Fedora Core 6, Apache Maven 2.2.1
      Slave: JDK 1.6.0_26-b03/x64 on Ubuntu 10.04.3 LTS/x64, Apache Maven 2.2.1

      Building a Maven project on a slave with Use private Maven repository breaks the "Redeploy artifacts" functionality.

      Work-around: After the build, change setting to [ ] Use private maven repository and Redeploy. The correct artifacts from the private repository are deployed.

      Project http://www.mygrid.org.uk/jenkins/job/com.example.helloworld/1/redeploy/ gives:

      [INFO] Deployment in file:///tmp/test1337 (id=test1337,uniqueVersion=true)
      Deploying the main artifact helloworld-0.0.1-SNAPSHOT.jar
      org.apache.maven.artifact.deployer.ArtifactDeploymentException: Failed to update metadata com.example:helloworld:0.0.1-SNAPSHOT/maven-metadata.xml: Could not write metadata /home/jenkins/jenkins/workspace/com.example.helloworld/.repository/com/example/helloworld/0.0.1-SNAPSHOT/maven-metadata-test1337.xml: /home/jenkins/jenkins/workspace/com.example.helloworld/.repository/com/example/helloworld/0.0.1-SNAPSHOT/maven-metadata-test1337.xml (No such file or directory)
      	at org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:141)
      	at hudson.maven.reporters.MavenArtifactRecord.deploy(MavenArtifactRecord.java:189)
      	at hudson.maven.reporters.MavenAggregatedArtifactRecord.deploy(MavenAggregatedArtifactRecord.java:95)
      	at hudson.maven.reporters.MavenAbstractArtifactRecord$1.perform(MavenAbstractArtifactRecord.java:233)
      	at hudson.model.TaskThread.run(TaskThread.java:126)
      Caused by: org.sonatype.aether.deployment.DeploymentException: Failed to update metadata com.example:helloworld:0.0.1-SNAPSHOT/maven-metadata.xml: Could not write metadata /home/jenkins/jenkins/workspace/com.example.helloworld/.repository/com/example/helloworld/0.0.1-SNAPSHOT/maven-metadata-test1337.xml: /home/jenkins/jenkins/workspace/com.example.helloworld/.repository/com/example/helloworld/0.0.1-SNAPSHOT/maven-metadata-test1337.xml (No such file or directory)
      	at org.sonatype.aether.impl.internal.DefaultDeployer.upload(DefaultDeployer.java:418)
      	at org.sonatype.aether.impl.internal.DefaultDeployer.deploy(DefaultDeployer.java:260)
      	at org.sonatype.aether.impl.internal.DefaultDeployer.deploy(DefaultDeployer.java:215)
      	at org.sonatype.aether.impl.internal.DefaultRepositorySystem.deploy(DefaultRepositorySystem.java:480)
      	at org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:137)
      	... 4 more
      Caused by: org.sonatype.aether.RepositoryException: Could not write metadata /home/jenkins/jenkins/workspace/com.example.helloworld/.repository/com/example/helloworld/0.0.1-SNAPSHOT/maven-metadata-test1337.xml: /home/jenkins/jenkins/workspace/com.example.helloworld/.repository/com/example/helloworld/0.0.1-SNAPSHOT/maven-metadata-test1337.xml (No such file or directory)
      	at org.apache.maven.repository.internal.MavenMetadata.write(MavenMetadata.java:125)
      	at org.apache.maven.repository.internal.MavenMetadata.merge(MavenMetadata.java:73)
      	at org.sonatype.aether.impl.internal.DefaultDeployer.upload(DefaultDeployer.java:414)
      	... 8 more
      Caused by: java.io.FileNotFoundException: /home/jenkins/jenkins/workspace/com.example.helloworld/.repository/com/example/helloworld/0.0.1-SNAPSHOT/maven-metadata-test1337.xml (No such file or directory)
      	at java.io.FileOutputStream.open(Native Method)
      	at java.io.FileOutputStream.<init>(FileOutputStream.java:179)
      	at java.io.FileOutputStream.<init>(FileOutputStream.java:131)
      	at org.codehaus.plexus.util.xml.XmlStreamWriter.<init>(XmlStreamWriter.java:59)
      	at org.codehaus.plexus.util.WriterFactory.newXmlWriter(WriterFactory.java:117)
      	at org.apache.maven.repository.internal.MavenMetadata.write(MavenMetadata.java:120)
      	... 10 more
      

      Note: /home/jenkins/jenkins/ is the path of the slave. Master is in /local/hudson.

      To reproduce:

      • Set up a slave, disable builds on master (alternatively - tie build to slave)
      • Create a new Jenkins project for Maven 2/3.
        • Source code: GIT - git://github.com/stain/helloworld.git (Problem also exists with Subversion)
        • Build - Goals and options: clean install
          • Advanced: [x] Use private Maven repository
      • Save, then Build Now.
      • Go to Last Successful Build.
      • Click Redeploy Artifacts.
      • Advanced:
        • Repository URL: file:///tmp/example
        • Repository ID: example
        • [x] Assign unique versions to snapshots (fails with both settings)
        • OK

      This seems related to JENKINS-8711.

      Note - changing the configuration to do a Post-build deploy works:

      • Post-build actions
        • (Same settings as above)
        • Save, Build

      See http://www.mygrid.org.uk/jenkins/job/com.example.helloworld/2/console for successful deployment.

      [INFO] BUILD SUCCESSFUL
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 5 seconds
      [INFO] Finished at: Fri Jul 22 10:39:58 BST 2011
      [INFO] Final Memory: 14M/34M
      [INFO] ------------------------------------------------------------------------
      channel stopped
      Maven RedeployPublished use remote jenkins-vm.taverna.org.uk maven settings from : /home/jenkins/.m2/settings.xml
      [INFO] Deployment in file:///tmp/example (id=example,uniqueVersion=true)
      Deploying the main artifact helloworld-0.0.1-SNAPSHOT.jar
      [INFO] Deployment done in 0.28 sec
      Finished: SUCCESS
      

      The files got correctly deployed on /tmp of the master (and not on the slave):

      root@rosalind-) ls /tmp/example/com/example/helloworld/
      0.0.1-SNAPSHOT      maven-metadata.xml.md5
      maven-metadata.xml  maven-metadata.xml.sha1
      

      However, redeploy from this build does not work.

      Later changing the configuration to NOT Use private Maven repository and rebuilding works:
      http://www.mygrid.org.uk/jenkins/job/com.example.helloworld/4/redeploy/

      [INFO] Deployment in file:///tmp/example3 (id=example3,uniqueVersion=true)
      Deploying the main artifact helloworld-0.0.1-SNAPSHOT.jar
      Completed
      

      In fact - this allows redeploying on the initial build 1 as well!

      http://www.mygrid.org.uk/jenkins/job/com.example.helloworld/1/redeploy/2/

      [INFO] Deployment in file:///tmp/test5 (id=test5,uniqueVersion=true)
      Deploying the main artifact helloworld-0.0.1-SNAPSHOT.jar
      Completed
      

      When checking the md5-sums on the deployed folder on the master:

      root@rosalind-) md5sum /tmp/test5/com/example/helloworld/0.0.1-SNAPSHOT/helloworld-0.0.1-20110722.094641-1.jar
      980f75ad9126031ff46f2ee03dcc64e9  /tmp/test5/com/example/helloworld/0.0.1-SNAPSHOT/helloworld-0.0.1-20110722.094641-1.jar
      

      These matches the original build http://www.mygrid.org.uk/jenkins/job/com.example.helloworld/1/com.example$helloworld/artifact/com.example/helloworld/0.0.1-SNAPSHOT/helloworld-0.0.1-SNAPSHOT.jar/*fingerprint*/
      and not the latest non-private build
      http://www.mygrid.org.uk/jenkins/job/com.example.helloworld/4/com.example$helloworld/artifact/com.example/helloworld/0.0.1-SNAPSHOT/helloworld-0.0.1-SNAPSHOT.jar/*fingerprint*/

      .. so Jenkins did deploy the right version from the private repository.

      As a counter-example, change the setting back to use the private repository and try to redeploy build 4 (build without private):

      http://www.mygrid.org.uk/jenkins/job/com.example.helloworld/4/redeploy/ fails with similar stack trace:

      [INFO] Deployment in file:///tmp/example13 (id=example13,uniqueVersion=true)
      Deploying the main artifact helloworld-0.0.1-SNAPSHOT.jar
      org.apache.maven.artifact.deployer.ArtifactDeploymentException: Failed to update metadata com.example:helloworld:0.0.1-SNAPSHOT/maven-metadata.xml: Could not write metadata /home/jenkins/jenkins/workspace/com.example.helloworld/.repository/com/example/helloworld/0.0.1-SNAPSHOT/maven-metadata-example13.xml: /home/jenkins/jenkins/workspace/com.example.helloworld/.repository/com/example/helloworld/0.0.1-SNAPSHOT/maven-metadata-example13.xml (No such file or directory)
      	at org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:141)
      	at hudson.maven.reporters.MavenArtifactRecord.deploy(MavenArtifactRecord.java:189)
      	at hudson.maven.reporters.MavenAggregatedArtifactRecord.deploy(MavenAggregatedArtifactRecord.java:95)
      	at hudson.maven.reporters.MavenAbstractArtifactRecord$1.perform(MavenAbstractArtifactRecord.java:233)
      	at hudson.model.TaskThread.run(TaskThread.java:126)
      Caused by: org.sonatype.aether.deployment.DeploymentException: Failed to update metadata com.example:helloworld:0.0.1-SNAPSHOT/maven-metadata.xml: Could not write metadata /home/jenkins/jenkins/workspace/com.example.helloworld/.repository/com/example/helloworld/0.0.1-SNAPSHOT/maven-metadata-example13.xml: /home/jenkins/jenkins/workspace/com.example.helloworld/.repository/com/example/helloworld/0.0.1-SNAPSHOT/maven-metadata-example13.xml (No such file or directory)
      	at org.sonatype.aether.impl.internal.DefaultDeployer.upload(DefaultDeployer.java:418)
      	at org.sonatype.aether.impl.internal.DefaultDeployer.deploy(DefaultDeployer.java:260)
      	at org.sonatype.aether.impl.internal.DefaultDeployer.deploy(DefaultDeployer.java:215)
      	at org.sonatype.aether.impl.internal.DefaultRepositorySystem.deploy(DefaultRepositorySystem.java:480)
      	at org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:137)
      	... 4 more
      Caused by: org.sonatype.aether.RepositoryException: Could not write metadata /home/jenkins/jenkins/workspace/com.example.helloworld/.repository/com/example/helloworld/0.0.1-SNAPSHOT/maven-metadata-example13.xml: /home/jenkins/jenkins/workspace/com.example.helloworld/.repository/com/example/helloworld/0.0.1-SNAPSHOT/maven-metadata-example13.xml (No such file or directory)
      	at org.apache.maven.repository.internal.MavenMetadata.write(MavenMetadata.java:125)
      	at org.apache.maven.repository.internal.MavenMetadata.merge(MavenMetadata.java:73)
      	at org.sonatype.aether.impl.internal.DefaultDeployer.upload(DefaultDeployer.java:414)
      	... 8 more
      Caused by: java.io.FileNotFoundException: /home/jenkins/jenkins/workspace/com.example.helloworld/.repository/com/example/helloworld/0.0.1-SNAPSHOT/maven-metadata-example13.xml (No such file or directory)
      	at java.io.FileOutputStream.open(Native Method)
      	at java.io.FileOutputStream.<init>(FileOutputStream.java:179)
      	at java.io.FileOutputStream.<init>(FileOutputStream.java:131)
      	at org.codehaus.plexus.util.xml.XmlStreamWriter.<init>(XmlStreamWriter.java:59)
      	at org.codehaus.plexus.util.WriterFactory.newXmlWriter(WriterFactory.java:117)
      	at org.apache.maven.repository.internal.MavenMetadata.write(MavenMetadata.java:120)
      	... 10 more
      

            Unassigned Unassigned
            soilandreyes Stian Soiland-Reyes
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: