提交 a5d9528c 编写于 作者: O Olivier Lamy

[FIXED JENKINS-8865] Environment variable not available for Maven build/POM parsing.

上级 f9f030db
......@@ -54,6 +54,7 @@ import hudson.model.TaskListener;
import hudson.remoting.Channel;
import hudson.remoting.VirtualChannel;
import hudson.scm.ChangeLogSet;
import hudson.slaves.NodeProperty;
import hudson.tasks.BuildWrapper;
import hudson.tasks.MailSender;
import hudson.tasks.Maven.MavenInstallation;
......@@ -725,7 +726,7 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
List<PomInfo> poms;
try {
poms = getModuleRoot().act(new PomParser(listener, mvn, project, mavenVersion));
poms = getModuleRoot().act(new PomParser(listener, mvn, project, mavenVersion, envVars));
} catch (IOException e) {
if (e.getCause() instanceof AbortException)
throw (AbortException) e.getCause();
......@@ -1046,7 +1047,7 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
String rootPOMRelPrefix;
public PomParser(BuildListener listener, MavenInstallation mavenHome, MavenModuleSet project,String mavenVersion) {
public PomParser(BuildListener listener, MavenInstallation mavenHome, MavenModuleSet project,String mavenVersion,EnvVars envVars) {
// project cannot be shipped to the remote JVM, so all the relevant properties need to be captured now.
this.listener = listener;
this.mavenHome = mavenHome;
......@@ -1062,6 +1063,14 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
}
}
}
if (envVars != null && !envVars.isEmpty()) {
for (Entry<String,String> entry : envVars.entrySet()) {
if (entry.getKey() != null && entry.getValue() != null) {
this.properties.put( "env." + entry.getKey(), entry.getValue() );
}
}
}
this.nonRecursive = project.isNonRecursive();
this.workspaceProper = project.getLastBuild().getWorkspace().getRemote();
if (project.usesPrivateRepository()) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册