mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-16 05:22:22 +00:00
[FIXED HUDSON-2575] Added support for optional alternate Maven settings file
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@20291 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
1 parent
7bd1399214
commit
0bd488e027
8 files changed
+84
-14
No files matched your search
@@ -456,6 +456,11 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
|
||||
margs.add("-amd");
|
||||
margs.add("-pl", Util.join(changedModules, ","));
|
||||
}
|
||||
|
||||
if (project.getAlternateSettings() != null) {
|
||||
margs.add("-s").add(project.getWorkspace().child(project.getAlternateSettings()));
|
||||
}
|
||||
|
||||
margs.addTokenized(envVars.expand(project.getGoals()));
|
||||
|
||||
Builder builder = new Builder(slistener, proxies, project.sortedActiveModules, margs.toList(), envVars);
|
||||
@@ -779,11 +784,12 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
|
||||
* Capture the value of the static field so that the debug flag
|
||||
* takes an effect even when {@link PomParser} runs in a slave.
|
||||
*/
|
||||
private final boolean versbose = debug;
|
||||
private final boolean verbose = debug;
|
||||
private final MavenInstallation mavenHome;
|
||||
private final String profiles;
|
||||
private final Properties properties;
|
||||
private final String privateRepository;
|
||||
private final String alternateSettings;
|
||||
|
||||
public PomParser(BuildListener listener, MavenInstallation mavenHome, MavenModuleSet project) {
|
||||
// project cannot be shipped to the remote JVM, so all the relevant properties need to be captured now.
|
||||
@@ -798,6 +804,7 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
|
||||
else {
|
||||
this.privateRepository = null;
|
||||
}
|
||||
this.alternateSettings = project.getAlternateSettings();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -825,20 +832,27 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
|
||||
pom = parentLoc;
|
||||
|
||||
if(!pom.exists())
|
||||
throw new AbortException(Messages.MavenModuleSetBuild_NoSuchFile(pom));
|
||||
throw new AbortException(Messages.MavenModuleSetBuild_NoSuchPOMFile(pom));
|
||||
|
||||
if(versbose)
|
||||
if(verbose)
|
||||
logger.println("Parsing "+pom);
|
||||
|
||||
File settingsLoc = (alternateSettings == null) ? null
|
||||
: new File(ws, alternateSettings);
|
||||
|
||||
if ((settingsLoc != null) && (!settingsLoc.exists())) {
|
||||
throw new AbortException(Messages.MavenModuleSetBuild_NoSuchAlternateSettings(settingsLoc.getAbsolutePath()));
|
||||
}
|
||||
|
||||
try {
|
||||
MavenEmbedder embedder = MavenUtil.
|
||||
createEmbedder(listener, mavenHome.getHomeDir(), profiles,
|
||||
properties, privateRepository);
|
||||
properties, privateRepository, settingsLoc);
|
||||
MavenProject mp = embedder.readProject(pom);
|
||||
Map<MavenProject,String> relPath = new HashMap<MavenProject,String>();
|
||||
MavenUtil.resolveModules(embedder,mp,getRootPath(),relPath,listener);
|
||||
|
||||
if(versbose) {
|
||||
if(verbose) {
|
||||
for (Entry<MavenProject, String> e : relPath.entrySet())
|
||||
logger.printf("Discovered %s at %s\n",e.getKey().getId(),e.getValue());
|
||||
}
|
||||
@@ -871,7 +885,7 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
|
||||
private static final Logger LOGGER = Logger.getLogger(MavenModuleSetBuild.class.getName());
|
||||
|
||||
/**
|
||||
* Extra versbose debug switch.
|
||||
* Extra verbose debug switch.
|
||||
*/
|
||||
public static boolean debug = false;
|
||||
|
||||
|
||||
Reference in new issue
Block a user