Skip to content

Commit

Permalink
Added support to MavenBuild for alternateSettings
Browse files Browse the repository at this point in the history
JENKINS-8670

Originally-Committed-As: ec9dce7dbae9ca7b2bf72d66413109084cd8c863
  • Loading branch information
kphonik committed Feb 8, 2011
1 parent 3239bbf commit 80a1b23
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions 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 80a1b23

Please sign in to comment.