Skip to content

Commit

Permalink
[FIXED JENKINS-9084] Regression in jenkins .401 maven plugin - deploy…
Browse files Browse the repository at this point in the history
… to repository post-task

logic to get remote settings.xml file, test in this order (as maven do)
1. configured alternateSettings
2. ~/.m2/settings.xml
3. $M2_HOME/conf/settings.xml
  • Loading branch information
olamy committed Mar 19, 2011
1 parent 2aad402 commit 0868af6
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions maven-plugin/src/main/java/hudson/maven/RedeployPublisher.java
Expand Up @@ -31,26 +31,25 @@
import hudson.model.AbstractBuild;
import hudson.model.AbstractProject;
import hudson.model.BuildListener;
import hudson.model.Computer;
import hudson.model.Hudson;
import hudson.model.Node;
import hudson.model.Result;
import hudson.model.TaskListener;
import hudson.remoting.Callable;
import hudson.tasks.BuildStepDescriptor;
import hudson.tasks.BuildStepMonitor;
import hudson.tasks.Maven.MavenInstallation;
import hudson.tasks.Publisher;
import hudson.tasks.Recorder;
import hudson.tasks.Maven.MavenInstallation;
import hudson.tasks.Maven.ProjectWithMaven;
import hudson.util.FormValidation;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Properties;
import java.util.Map.Entry;
import java.util.Properties;

import net.sf.json.JSONObject;

Expand Down Expand Up @@ -194,11 +193,18 @@ private MavenEmbedder createEmbedder(TaskListener listener, AbstractBuild<?,?> b

// we copy this file in the master in a temporary file
FilePath filePath = new FilePath( tmpSettings );
FilePath remoteSettings = build.getWorkspace().child( altSettingsPath);
if (remoteSettings.exists()) {
remoteSettings.copyTo( filePath );
settingsLoc = tmpSettings;
FilePath remoteSettings = build.getWorkspace().child( altSettingsPath );
if (!remoteSettings.exists()) {
// JENKINS-9084 we finally use $M2_HOME/conf/settings.xml as maven do
Node buildNode = Hudson.getInstance().getNode( build.getBuiltOnStr() );
String mavenHome =
((MavenModuleSet) project).getMaven().forNode(buildNode, listener ).getHome();
String settingsPath = mavenHome + "/conf/settings.xml";
remoteSettings = build.getWorkspace().child( settingsPath);
}
System.out.print( "use remote maven settings from : " + remoteSettings.getRemote() );
remoteSettings.copyTo( filePath );
settingsLoc = tmpSettings;

}

Expand Down

0 comments on commit 0868af6

Please sign in to comment.