diff --git a/core/src/main/java/hudson/maven/MavenModuleSet.java b/core/src/main/java/hudson/maven/MavenModuleSet.java index 93a8eda8e52b6ed58824838c433db85e4dd0113f..f354f898b0a555400f27ebf8bd75f5fcd871d934 100644 --- a/core/src/main/java/hudson/maven/MavenModuleSet.java +++ b/core/src/main/java/hudson/maven/MavenModuleSet.java @@ -2,6 +2,7 @@ package hudson.maven; import hudson.FilePath; import hudson.Launcher; +import hudson.Util; import hudson.triggers.Trigger; import hudson.model.AbstractProject; import hudson.model.DependencyGraph; @@ -48,6 +49,8 @@ public class MavenModuleSet extends AbstractProjectpom.xml relative to the workspace root. + */ + public String getRootPOM() { + if(rootPOM==null) return "pom.xml"; + return rootPOM; + } + + /*package*/ void setRootModule(ModuleName rootModule) throws IOException { if(this.rootModule!=null && this.rootModule.equals(rootModule)) return; // no change @@ -219,6 +231,9 @@ public class MavenModuleSet extends AbstractProject poms = project.getWorkspace().act(new PomParser(listener)); + List poms = project.getWorkspace().act(new PomParser(listener,project.getRootPOM())); // update the module list Map modules = project.modules; @@ -93,6 +93,9 @@ public final class MavenModuleSetBuild extends AbstractBuild> { private final BuildListener listener; + private final String rootPOM; - public PomParser(BuildListener listener) { + public PomParser(BuildListener listener, String rootPOM) { this.listener = listener; + this.rootPOM = rootPOM; } public List invoke(File ws, VirtualChannel channel) throws IOException { - // TODO: this logic needs to be smarter - File pom = new File(ws,"pom.xml"); + File pom = new File(ws,rootPOM); + + if(!pom.exists()) { + listener.getLogger().println("No such file "+pom); + listener.getLogger().println("Perhaps you need to specify the correct POM file path in the project configuration?"); + throw new AbortException(); + } try { MavenEmbedder embedder = MavenUtil.createEmbedder(listener); @@ -146,4 +156,8 @@ public final class MavenModuleSetBuild extends AbstractBuild + + + + + + diff --git a/war/resources/help/maven/root-pom.html b/war/resources/help/maven/root-pom.html new file mode 100644 index 0000000000000000000000000000000000000000..ebc25cd4cd7568bfd96acee5fe3ae6836ab3cf17 --- /dev/null +++ b/war/resources/help/maven/root-pom.html @@ -0,0 +1,7 @@ +
+ If your workspace has the top-level pom.xml in somewhere other + than the root directory of the workspace, specify the path (relative to + the workspace root) here, such as parent/pom.xml. +
+ If left empty, treated as pom.xml +
\ No newline at end of file