提交 fa9c5588 编写于 作者: K Kohsuke Kawaguchi

Merge branch 'JENKINS-8670'

* JENKINS-8670:
  [FIXED JENKINS-8670] recording the fix
  Added support to MavenBuild for alternateSettings
......@@ -58,7 +58,9 @@ Upcoming changes</a>
<!-- Record your changes in the trunk here. -->
<div id="trunk" style="display:none"><!--=TRUNK-BEGIN=-->
<ul class=image>
<li class=>
<li class=bug>
MavenBuild does not respect the "alternate settings" value of its parent MavenModuleSetBuild
(<a href="http://issues.jenkins-ci.org/browse/JENKINS-8670">issue 8670</a>)
</ul>
</div><!--=TRUNK-END=-->
......
......@@ -44,6 +44,7 @@ import hudson.scm.ChangeLogSet.Entry;
import hudson.tasks.BuildWrapper;
import hudson.tasks.Maven.MavenInstallation;
import hudson.util.ArgumentListBuilder;
import hudson.util.IOUtils;
import org.apache.maven.BuildFailureException;
import org.apache.maven.artifact.versioning.ComparableVersion;
import org.apache.maven.execution.MavenSession;
......@@ -601,6 +602,21 @@ public class MavenBuild extends AbstractMavenBuild<MavenModule,MavenBuild> {
// use the per-project repository. should it be per-module? But that would cost too much in terms of disk
// the workspace must be on this node, so getRemote() is safe.
margs.add("-Dmaven.repo.local="+getWorkspace().child(".repository").getRemote());
if (mms.getAlternateSettings() != null) {
if (IOUtils.isAbsolute(mms.getAlternateSettings())) {
margs.add("-s").add(mms.getAlternateSettings());
} else {
FilePath mrSettings = getModuleRoot().child(mms.getAlternateSettings());
FilePath wsSettings = getWorkspace().child(mms.getAlternateSettings());
if (!wsSettings.exists() && mrSettings.exists())
wsSettings = mrSettings;
margs.add("-s").add(wsSettings.getRemote());
}
}
margs.add("-f",getModuleRoot().child("pom.xml").getRemote());
margs.addTokenized(getProject().getGoals());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册