-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
Powered by SuggestiMate
When using the post-build action to deploy to the maven repository it looks for artifacts in ~/.m2/repository - and not the private maven repository for the job.
- is related to
-
JENKINS-10429 ArtifactDeploymentException on Redeploy when built on slave with private Maven repository
-
- Open
-
-
JENKINS-8939 Fix for JENKINS-8711 breaks deployments with credentials
-
- Resolved
-
[JENKINS-8711] Post build action deploy to maven repository does not honor the "private maven repository" setting
Hm - it did not work at some point - but now it does - so closing.
Great!
Hmm, actually it seems a little flaky:
14:08:02 maven builder waiting 14:08:02 channel stopped 14:08:02 Deploying artifacts to http://nexus.edb.com/nexus/content/repositories/snapshots/ 14:08:02 uniqueVersion == false is not anymore supported in maven 3 14:08:02 Deploying the main artifact pom.xml 14:08:02 ERROR: Failed to retrieve remote metadata com.edb.payment.pays:pays-core:1.1-SNAPSHOT/maven-metadata.xml: Could not transfer metadata com.edb.payment.pays:pays-core:1.1-SNAPSHOT/maven-metadata.xml from/to edb.snapshotRepostory (http://nexus.edb.com/nexus/content/repositories/snapshots/): Specified destination directory cannot be created: /home/hudson/workspace/pays-fastbuild/.repository/com/edb/payment/pays/pays-core/1.1-SNAPSHOT 14:08:02 org.apache.maven.artifact.deployer.ArtifactDeploymentException: Failed to retrieve remote metadata com.edb.payment.pays:pays-core:1.1-SNAPSHOT/maven-metadata.xml: Could not transfer metadata com.edb.payment.pays:pays-core:1.1-SNAPSHOT/maven-metadata.xml from/to edb.snapshotRepostory (http://nexus.edb.com/nexus/content/repositories/snapshots/): Specified destination directory cannot be created: /home/hudson/workspace/pays-fastbuild/.repository/com/edb/payment/pays/pays-core/1.1-SNAPSHOT 14:08:02 at org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:140) 14:08:02 at hudson.maven.reporters.MavenArtifactRecord.deploy(MavenArtifactRecord.java:136) 14:08:02 at hudson.maven.RedeployPublisher.perform(RedeployPublisher.java:128) 14:08:02 at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19) 14:08:02 at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:624) 14:08:02 at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:603) 14:08:02 at hudson.maven.MavenModuleSetBuild$RunnerImpl.post2(MavenModuleSetBuild.java:766) 14:08:02 at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:550) 14:08:02 at hudson.model.Run.run(Run.java:1386) 14:08:02 at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:406) 14:08:02 at hudson.model.ResourceController.execute(ResourceController.java:88) 14:08:02 at hudson.model.Executor.run(Executor.java:145) 14:08:02 Caused by: org.sonatype.aether.deployment.DeploymentException: Failed to retrieve remote metadata com.edb.payment.pays:pays-core:1.1-SNAPSHOT/maven-metadata.xml: Could not transfer metadata com.edb.payment.pays:pays-core:1.1-SNAPSHOT/maven-metadata.xml from/to edb.snapshotRepostory (http://nexus.edb.com/nexus/content/repositories/snapshots/): Specified destination directory cannot be created: /home/hudson/workspace/pays-fastbuild/.repository/com/edb/payment/pays/pays-core/1.1-SNAPSHOT 14:08:02 at org.sonatype.aether.impl.internal.DefaultDeployer.upload(DefaultDeployer.java:380) 14:08:02 at org.sonatype.aether.impl.internal.DefaultDeployer.deploy(DefaultDeployer.java:230) 14:08:02 at org.sonatype.aether.impl.internal.DefaultRepositorySystem.deploy(DefaultRepositorySystem.java:380) 14:08:02 at org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:136) 14:08:02 ... 11 more 14:08:02 Caused by: org.sonatype.aether.transfer.MetadataTransferException: Could not transfer metadata com.edb.payment.pays:pays-core:1.1-SNAPSHOT/maven-metadata.xml from/to edb.snapshotRepostory (http://nexus.edb.com/nexus/content/repositories/snapshots/): Specified destination directory cannot be created: /home/hudson/workspace/pays-fastbuild/.repository/com/edb/payment/pays/pays-core/1.1-SNAPSHOT 14:08:02 at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$3.wrap(WagonRepositoryConnector.java:932) 14:08:02 at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$3.wrap(WagonRepositoryConnector.java:923) 14:08:02 at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$GetTask.flush(WagonRepositoryConnector.java:696) 14:08:02 at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$GetTask.flush(WagonRepositoryConnector.java:690) 14:08:02 at org.sonatype.aether.connector.wagon.WagonRepositoryConnector.get(WagonRepositoryConnector.java:435) 14:08:02 at org.sonatype.aether.impl.internal.DefaultDeployer.upload(DefaultDeployer.java:353) 14:08:02 ... 14 more 14:08:02 Caused by: org.apache.maven.wagon.TransferFailedException: Specified destination directory cannot be created: /home/hudson/workspace/pays-fastbuild/.repository/com/edb/payment/pays/pays-core/1.1-SNAPSHOT 14:08:02 at org.apache.maven.wagon.AbstractWagon.createParentDirectories(AbstractWagon.java:253) 14:08:02 at org.apache.maven.wagon.AbstractWagon.getTransfer(AbstractWagon.java:291) 14:08:02 at org.apache.maven.wagon.AbstractWagon.getTransfer(AbstractWagon.java:276) 14:08:02 at org.apache.maven.wagon.StreamWagon.getIfNewer(StreamWagon.java:97) 14:08:02 at org.apache.maven.wagon.StreamWagon.get(StreamWagon.java:61) 14:08:02 at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$GetTask.run(WagonRepositoryConnector.java:605) 14:08:02 at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) 14:08:02 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) 14:08:02 at java.lang.Thread.run(Thread.java:662) 14:08:02 [TASKS] Skipping publisher since build result is FAILURE 14:08:02 [FINDBUGS] Skipping publisher since build result is FAILURE 14:08:02 [WARNINGS] Skipping publisher since build result is FAILURE 14:08:02 [PMD] Skipping publisher since build result is FAILURE 14:08:03 Skipping sonar analysis due to bad build status FAILURE 14:08:03 Email was triggered for: Failure 14:08:03 Sending email for trigger: Failure 14:08:03 Sending email to: David.Karlsen@edb.com 14:08:04 Notifying upstream projects of job completion 14:08:04 Finished: FAILURE
Now that job has started working properly (w/o changing any settings) - but another job fails consistently (just configured to to maven repo uploads):
maven builder waiting Archiving artifacts Deploying artifacts to http://nexus.edb.com/nexus/content/repositories/snapshots/ uniqueVersion == false is not anymore supported in maven 3 Deploying the main artifact entrabank-camel-1.0-SNAPSHOT.jar ERROR: Failed to retrieve remote metadata com.edb.finance.entrabank.integration:entrabank-camel:1.0-SNAPSHOT/maven-metadata.xml: Could not transfer metadata com.edb.finance.entrabank.integration:entrabank-camel:1.0-SNAPSHOT/maven-metadata.xml from/to edb.snapshotRepostory (http://nexus.edb.com/nexus/content/repositories/snapshots/): Specified destination directory cannot be created: /home/hudson/workspace/entrabank-integration-layer/.repository/com/edb/finance/entrabank/integration/entrabank-camel/1.0-SNAPSHOT org.apache.maven.artifact.deployer.ArtifactDeploymentException: Failed to retrieve remote metadata com.edb.finance.entrabank.integration:entrabank-camel:1.0-SNAPSHOT/maven-metadata.xml: Could not transfer metadata com.edb.finance.entrabank.integration:entrabank-camel:1.0-SNAPSHOT/maven-metadata.xml from/to edb.snapshotRepostory (http://nexus.edb.com/nexus/content/repositories/snapshots/): Specified destination directory cannot be created: /home/hudson/workspace/entrabank-integration-layer/.repository/com/edb/finance/entrabank/integration/entrabank-camel/1.0-SNAPSHOT at org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:140) at hudson.maven.reporters.MavenArtifactRecord.deploy(MavenArtifactRecord.java:136) at hudson.maven.RedeployPublisher.perform(RedeployPublisher.java:128) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19) at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:624) at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:603) at hudson.maven.MavenModuleSetBuild$RunnerImpl.post2(MavenModuleSetBuild.java:766) at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:550) at hudson.model.Run.run(Run.java:1386) at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:406) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:145) Caused by: org.sonatype.aether.deployment.DeploymentException: Failed to retrieve remote metadata com.edb.finance.entrabank.integration:entrabank-camel:1.0-SNAPSHOT/maven-metadata.xml: Could not transfer metadata com.edb.finance.entrabank.integration:entrabank-camel:1.0-SNAPSHOT/maven-metadata.xml from/to edb.snapshotRepostory (http://nexus.edb.com/nexus/content/repositories/snapshots/): Specified destination directory cannot be created: /home/hudson/workspace/entrabank-integration-layer/.repository/com/edb/finance/entrabank/integration/entrabank-camel/1.0-SNAPSHOT at org.sonatype.aether.impl.internal.DefaultDeployer.upload(DefaultDeployer.java:380) at org.sonatype.aether.impl.internal.DefaultDeployer.deploy(DefaultDeployer.java:230) at org.sonatype.aether.impl.internal.DefaultRepositorySystem.deploy(DefaultRepositorySystem.java:380) at org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:136) ... 11 more Caused by: org.sonatype.aether.transfer.MetadataTransferException: Could not transfer metadata com.edb.finance.entrabank.integration:entrabank-camel:1.0-SNAPSHOT/maven-metadata.xml from/to edb.snapshotRepostory (http://nexus.edb.com/nexus/content/repositories/snapshots/): Specified destination directory cannot be created: /home/hudson/workspace/entrabank-integration-layer/.repository/com/edb/finance/entrabank/integration/entrabank-camel/1.0-SNAPSHOT at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$3.wrap(WagonRepositoryConnector.java:932) at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$3.wrap(WagonRepositoryConnector.java:923) at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$GetTask.flush(WagonRepositoryConnector.java:696) at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$GetTask.flush(WagonRepositoryConnector.java:690) at org.sonatype.aether.connector.wagon.WagonRepositoryConnector.get(WagonRepositoryConnector.java:435) at org.sonatype.aether.impl.internal.DefaultDeployer.upload(DefaultDeployer.java:353) ... 14 more Caused by: org.apache.maven.wagon.TransferFailedException: Specified destination directory cannot be created: /home/hudson/workspace/entrabank-integration-layer/.repository/com/edb/finance/entrabank/integration/entrabank-camel/1.0-SNAPSHOT at org.apache.maven.wagon.AbstractWagon.createParentDirectories(AbstractWagon.java:253) at org.apache.maven.wagon.AbstractWagon.getTransfer(AbstractWagon.java:291) at org.apache.maven.wagon.AbstractWagon.getTransfer(AbstractWagon.java:276) at org.apache.maven.wagon.StreamWagon.getIfNewer(StreamWagon.java:97) at org.apache.maven.wagon.StreamWagon.get(StreamWagon.java:61) at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$GetTask.run(WagonRepositoryConnector.java:605) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662) [TASKS] Skipping publisher since build result is FAILURE
Can I provide any more usefaul debug info?
I have this exact same exception (except I can reproduce it everytime), and was about to post a new bug when I saw this come across. I encountered this when migrating to Jenkins from Hudson, but have since verified it is an issue with the current Hudson as well.
For us, this was an issue I believe introduced when Hudson started supporting Maven3 (we had other Maven3 issues when 1.392 came out and rolled back until now). My build works in Hudson 1.391, and does not currently work with Hudson 1.395, nor the latest Jenkins release.
We have a Master/slaves configuration and our job is running with Maven 2.2.1. It is a multi-module project, and some of the modules produce multiple artifacts (though I don't think that is related, as the first module to publish fails and only produces one artifact).
The error we have is that it reports the exception that it can't create the destination directory, but it is providing a filepath on the slave, that actually already exists and is readable by the slave (the maven build process created it).
Here is the error output (with search and replace of project/company names... hopefully it is still readable):
Deploying artifacts to https://COMPANY-NAME/content/repositories/snapshots/
Deploying the main artifact ARTIFACT-NAME-1.0.0-SNAPSHOT.pom
ERROR: Error retrieving previous build number for artifact 'GROUP-NAME:ARTIFACT-NAME:pom': repository metadata for: 'snapshot GROUP-NAME:ARTIFACT-NAME:1.0.0-SNAPSHOT' could not be retrieved from repository: nexus-snapshots due to an error: Specified destination directory cannot be created: /SLAVE-WORKSPACE/JOB-NAME/.repository/GROUPNAME/ARTIFACT-NAME/1.0.0-SNAPSHOT
org.apache.maven.artifact.deployer.ArtifactDeploymentException: Error retrieving previous build number for artifact 'GROUP-NAME:ARTIFACT-NAME:pom': repository metadata for: 'snapshot GROUP-NAME:ARTIFACT-NAME:1.0.0-SNAPSHOT' could not be retrieved from repository: inventrio-nexus-snapshots due to an error: Specified destination directory cannot be created: /SLAVE-WORKSPACE/JOB-NAME/.repository/GROUPNAME/ARTIFACT-NAME/1.0.0-SNAPSHOT
at hudson.maven.artifact.transform.SnapshotTransformation.transformForDeployment(SnapshotTransformation.java:110)
at hudson.maven.artifact.transform.DefaultArtifactTransformationManager.transformForDeployment(DefaultArtifactTransformationManager.java:71)
at hudson.maven.artifact.deployer.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:92)
at hudson.maven.reporters.MavenArtifactRecord.deployMavenArtifact(MavenArtifactRecord.java:139)
at hudson.maven.reporters.MavenArtifactRecord.deploy(MavenArtifactRecord.java:126)
at hudson.maven.RedeployPublisher.perform(RedeployPublisher.java:128)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:622)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:601)
at hudson.maven.MavenModuleSetBuild$RunnerImpl.post2(MavenModuleSetBuild.java:762)
at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:548)
at hudson.model.Run.run(Run.java:1386)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:405)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:145)
Caused by: org.apache.maven.artifact.repository.metadata.RepositoryMetadataResolutionException: repository metadata for: 'snapshot GROUP-NAME:ARTIFACT-NAME:1.0.0-SNAPSHOT' could not be retrieved from repository: nexus-snapshots due to an error: Specified destination directory cannot be created: /SLAVE-WORKSPACE/JOB-NAME/.repository/GROUPNAME/ARTIFACT-NAME/1.0.0-SNAPSHOT
at org.apache.maven.artifact.repository.metadata.DefaultRepositoryMetadataManager.resolveAlways(DefaultRepositoryMetadataManager.java:400)
at hudson.maven.artifact.transform.SnapshotTransformation.resolveLatestSnapshotBuildNumber(SnapshotTransformation.java:158)
at hudson.maven.artifact.transform.SnapshotTransformation.transformForDeployment(SnapshotTransformation.java:104)
... 14 more
Caused by: org.apache.maven.wagon.TransferFailedException: Specified destination directory cannot be created: /SLAVE-WORKSPACE/JOB-NAME/.repository/GROUPNAME/ARTIFACT-NAME/1.0.0-SNAPSHOT
at org.apache.maven.wagon.AbstractWagon.createParentDirectories(AbstractWagon.java:253)
at org.apache.maven.wagon.AbstractWagon.getTransfer(AbstractWagon.java:291)
at org.apache.maven.wagon.AbstractWagon.getTransfer(AbstractWagon.java:276)
at org.apache.maven.wagon.StreamWagon.getIfNewer(StreamWagon.java:97)
at org.apache.maven.wagon.StreamWagon.get(StreamWagon.java:61)
at org.apache.maven.repository.legacy.DefaultWagonManager.getRemoteFile(DefaultWagonManager.java:351)
at org.apache.maven.repository.legacy.DefaultWagonManager.getArtifactMetadataFromDeploymentRepository(DefaultWagonManager.java:215)
at org.apache.maven.artifact.repository.metadata.DefaultRepositoryMetadataManager.getArtifactMetadataFromDeploymentRepository(DefaultRepositoryMetadataManager.java:424)
at org.apache.maven.artifact.repository.metadata.DefaultRepositoryMetadataManager.resolveAlways(DefaultRepositoryMetadataManager.java:396)
... 16 more
If I just do a "deploy" goal in the build and not the post build action, it works, but I prefer to use the post build as I can ensure all the tests pass for all the modules.
Does the post build deploy action run on the master, or the slave? If on the Master, the filepath is wrong. If on the Slave, it is failing saying it can't create a directory that already exists and it (the slave process) owns, has permissions on, and already created.
I would note the "name" of this description is misleading (at least since the reopen), as it is in fact using the "private maven repository" but it's not working. I believe this used to be a bug (not using the private repo), but is now a different problem.
the issue comes from the "use private repo", the "maven embedder" use the local repository path from your slave.
Code changed in jenkins
User: Olivier Lamy
Path:
maven-plugin/src/main/java/hudson/maven/RedeployPublisher.java
http://jenkins-ci.org/commit/core/7dc2652349b2e94de23d024cf1ad69309f3c92e0
Log:
JENKINS-8711 Post build action deploy to maven repository can fail using "private maven repository" option
Code changed in jenkins
User: Olivier Lamy
Path:
changelog.html
http://jenkins-ci.org/commit/core/7f5aef3468dca382a10669dd8d56b48f54004834
Log:
[FIXED JENKINS-8711] add changelog entry
If you want to try the fix I have pushed a buid here : http://people.apache.org/~olamy/jenkins/
Integrated in jenkins_main_trunk #529
JENKINS-8711 Post build action deploy to maven repository can fail using "private maven repository" option
[FIXED JENKINS-8711] add changelog entry
Olivier Lamy :
Files :
- maven-plugin/src/main/java/hudson/maven/RedeployPublisher.java
Olivier Lamy :
Files :
- changelog.html
However my slaves started failing with
[frontend-common-3.5] $ /var/lib/jenkins/tools/sun-1.5-jdk/bin/java -Xmx512m -cp /home/hudson/maven-agent.jar:/home/hudson/classworlds.jar hudson.maven.agent.Main /var/lib/jenkins/tools/apache-maven-default /home/hudson/slave.jar /home/hudson/maven-interceptor.jar 33395 /home/hudson/maven2.1-interceptor.jar Exception in thread "main" java.lang.ClassNotFoundException: hudson.remoting.Launcher at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at org.codehaus.classworlds.RealmClassLoader.loadClassDirect(RealmClassLoader.java:195) at org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:255) at org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:274) at org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:274) at hudson.maven.agent.Main.main(Main.java:126) at hudson.maven.agent.Main.main(Main.java:62) ERROR: Failed to parse POMs java.net.SocketException: Connection reset at java.net.SocketInputStream.read(SocketInputStream.java:168) at java.io.FilterInputStream.read(FilterInputStream.java:116) at hudson.remoting.ProxyInputStream$Buffer.read(ProxyInputStream.java:110) at hudson.remoting.ProxyInputStream$Chunk.perform(ProxyInputStream.java:132) at hudson.remoting.ProxyInputStream$Chunk.perform(ProxyInputStream.java:119) at hudson.remoting.Request$2.run(Request.java:270) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at hudson.remoting.Engine$1$1.run(Engine.java:59) at java.lang.Thread.run(Thread.java:662)
but that might be unrelated?
Prior to this checkin, this had been working for me. After, I am getting HTTP 401 Unauthorized errors when trying to deploy to my nexus server.
I specify a URL and a repository ID in the job configuration, and the settings files contains:
<servers>
<server>
<id>repository-id</id>
<username>Username</username>
<password>Password</password>
</server>
</servers>
When I trace the traffic to the nexus server I do not see any credentials being passed.
I see from the your checkin that you are simply ignoring the settings file. So, naturally, the credentials don't work.
I have authorization configured on my server and it seems to work, but i have settings.xml on both master and slaves.
For me, the settings file is part of the checkout. Ignoring the settings file just seems wrong. How can the master know what the settings file will be for a particular job? Wouldn't it be better to do the deploy from the slave rather than the master?
@pgweiss the settings.xml with the correct karma is where ?
- @slave : ~/.m2/settings.xml
- @master : ~/.m2/settings.xml
- specified tru cli with
s,-settings
In my job, I have a svn resources like this:
http://svn/svn/ita/trunk/build/maven
And in the job config I specify the settings file as
maven/settings.xml
That file contains the credentials for the deploy.
FWIW, I reverted your checkin in my branch of Jenkins and rebuilt.
I configured my job to always run on a slave. The job has a local repository, has a settings file which I get via svn, and I made sure that the slave directory was a pathname that does not exist on the master. The deploy worked perfectly.
So what was wrong in the first place?
-P
I suppose that if the settings file on the slave was configured to be something that was not in the workspace you would have a problem. But I don't consider that a bug. I always try to make sure that nothing in my job depends on anything on the slave. It make it a lot easier to provision slaves.
@pgweiss could please open an other issue ?
as this one is fixed but has generate a side effect.
I will work tomorrow on this !
OK, I've opened JENKINS-8939 and assigned it to you. I'd still like to know the particulars of the case that this bug was meant to solve.
so the patch has been reworked to prevent JENKINS-8939.
war for test uploaded here : http://people.apache.org/~olamy/jenkins/
I've used the patch as well as the latest release of Jenkins.
The post build action says that it's using the correct maven settings.xml but does not honor the <localRepository> that's set.
The Maven RedeployPublished use remote maven settings from : /privdir/djbs002/.m2/settings.xml
Caused by: org.apache.maven.wagon.TransferFailedException: Specified destination directory cannot be created: ~/.m2/repository/XXX
Same here in the logs I have : "Maven RedeployPublished use remote maven settings from : /home/kgr_mvn/.m2/settings.xml"
This is correct however: localRepository value is ignore.
Configuring the job to use a per job repository does not work either (<localRepository class="hudson.maven.local_repo.PerJobLocalRepositoryLocator"/>).
The publication fails because it tries to use the default path ($HOME/.m2/repository) ...
Code changed in jenkins
User: Olivier Lamy
Path:
src/main/java/hudson/maven/RedeployPublisher.java
http://jenkins-ci.org/commit/maven-plugin/ee09340fdc372b6ed7b4ebfddb73960d5af115f3
Log:
JENKINS-8711 Post build action deploy to maven repository can fail using "private maven repository" option
Originally-Committed-As: 7dc2652349b2e94de23d024cf1ad69309f3c92e0
Code changed in jenkins
User: Olivier Lamy
Path:
src/main/java/hudson/maven/MavenModuleSetBuild.java
src/main/java/hudson/maven/RedeployPublisher.java
http://jenkins-ci.org/commit/maven-plugin/1e34e36ba2b1c8a44a0d67ad74df407e7ba6368a
Log:
[FIXED JENKINS-8939] Fix for JENKINS-8711 breaks deployments with credentials
take care about using settings from the remote node
Originally-Committed-As: 1458f93a3c809bf8b5a4f2b1ed3de3769bffc715
I just had an issue that let me discover this one which is for now considered as a normal behavior (https://github.com/jenkinsci/maven-plugin/blob/master/src/main/java/hudson/maven/RedeployPublisher.java#L203)
Not totally wrong as I wrote a part of this code and that's right that the upload is done from master (that's why it requires to archive artifacts to move back artifacts from the agent to master) and thus on master the workspace can be missing thus using always the shared $HOME/.m2/repository is a solution.
The problem is that it may create conflict between jobs trying to upload at the same time (that's why the ability to use a repository local to each workspace was added).
I don't have a real solution.
Enforcing to create a local workspace on master for the job could be a solution with less conflicts but it may always happen (if another build is starting on master for the same job).
Using a temp directory will enforce maven to download the earth each time ....
Perhaps the best solution nowadays could be to use the deployAtEnd option of the recent version of the maven-deploy-plugin : https://maven.apache.org/plugins/maven-deploy-plugin/deploy-mojo.html#deployAtEnd
I'll wait for a 2.9 release before using AtTheEnd option because for now it is doing it silently due to a bug. It was fixed in incoming 2.9 : http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployMojo.java?r1=1531347&r2=1540334&pathrev=1540334&diff_format=h
Why is the deploy done from the master, shouldn't it be done from the slave where the job was built?
No possible, the workspace may not be available when using a ReDeploy
do you have any logs for this ?
because "attached" artifacts are use (ie : target/*.jar or *.war), artifacts produced by the maven build