if (config.content != null ) {
remoteGlobalSettingsFromConfig = SettingsProviderUtils.copyConfigContentToFile( config );
}
}
}
Node buildNode = build.getBuiltOn();
if(buildNode == null) {
// assume that build was made on master
buildNode = Jenkins.getInstance();
}
if (StringUtils.isBlank( altSettingsPath ) ) {
// get userHome from the node where job has been executed
String remoteUserHome = build.getWorkspace().act( new GetUserHome() );
altSettingsPath = remoteUserHome + "/.m2/settings.xml";
}
// 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()) {
// JENKINS-9084 we finally use $M2_HOME/conf/settings.xml as maven do
String mavenHome =
((MavenModuleSet) project).getMaven().forNode(buildNode, listener ).getHome();
String settingsPath = mavenHome + "/conf/settings.xml";
remoteSettings = build.getWorkspace().child( settingsPath);
}
listener.getLogger().println( "Maven RedeployPublished use remote " + (buildNode != null ? buildNode.getNodeName() : "local" )
+ " maven settings from : " + remoteSettings.getRemote() );
remoteSettings.copyTo( filePath );
settingsLoc = tmpSettings;
}