Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'JENKINS-8670'
* JENKINS-8670:
  [FIXED JENKINS-8670] recording the fix
  Added support to MavenBuild for alternateSettings
  • Loading branch information
kohsuke committed Feb 8, 2011
2 parents e0879e8 + f6bd1f3 commit fa9c558
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
4 changes: 3 additions & 1 deletion changelog.html
Expand Up @@ -58,7 +58,9 @@
<!-- 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=-->

Expand Down
16 changes: 16 additions & 0 deletions maven-plugin/src/main/java/hudson/maven/MavenBuild.java
Expand Up @@ -44,6 +44,7 @@
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;
Expand Down Expand Up @@ -601,6 +602,21 @@ protected Result doRun(BuildListener listener) throws Exception {
// 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());

Expand Down

0 comments on commit fa9c558

Please sign in to comment.