mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-17 14:02:22 +00:00
fixed #471 "Unnecessary stack trace dump" when a referenced POM was not found.
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@3120 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
1 parent
24813a3ca9
commit
ff8e660cf8
2 files changed
+12
-5
No files matched your search
@@ -8,7 +8,6 @@ import hudson.model.BuildListener;
|
||||
import hudson.model.Hudson;
|
||||
import hudson.model.Result;
|
||||
import hudson.remoting.VirtualChannel;
|
||||
import hudson.tasks.test.AbstractTestResultAction;
|
||||
import hudson.util.IOException2;
|
||||
import org.apache.maven.embedder.MavenEmbedderException;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
@@ -24,8 +23,8 @@ import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* {@link Build} for {@link MavenModuleSet}.
|
||||
@@ -284,7 +283,7 @@ public final class MavenModuleSetBuild extends AbstractBuild<MavenModuleSet,Mave
|
||||
MavenEmbedder embedder = MavenUtil.createEmbedder(listener);
|
||||
MavenProject mp = embedder.readProject(pom);
|
||||
Map<MavenProject,String> relPath = new HashMap<MavenProject,String>();
|
||||
MavenUtil.resolveModules(embedder,mp,getRootPath(),relPath);
|
||||
MavenUtil.resolveModules(embedder,mp,getRootPath(),relPath,listener);
|
||||
|
||||
List<PomInfo> infos = new ArrayList<PomInfo>();
|
||||
toPomInfo(mp,null,relPath,infos);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package hudson.maven;
|
||||
|
||||
import hudson.model.TaskListener;
|
||||
import hudson.model.BuildListener;
|
||||
import org.apache.maven.embedder.MavenEmbedderException;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.apache.maven.project.ProjectBuildingException;
|
||||
@@ -55,8 +56,11 @@ public class MavenUtil {
|
||||
* Upon the completion of this method, this variable stores the relative path
|
||||
* from the root directory of the given {@link MavenProject} to the root directory
|
||||
* of each of the newly parsed {@link MavenProject}.
|
||||
*
|
||||
* @throws AbortException
|
||||
* errors will be reported to the listener and the exception thrown.
|
||||
*/
|
||||
public static void resolveModules(MavenEmbedder embedder, MavenProject project, String rel, Map<MavenProject,String> relativePathInfo) throws ProjectBuildingException {
|
||||
public static void resolveModules(MavenEmbedder embedder, MavenProject project, String rel, Map<MavenProject,String> relativePathInfo, BuildListener listener) throws ProjectBuildingException, AbortException {
|
||||
|
||||
File basedir = project.getFile().getParentFile();
|
||||
relativePathInfo.put(project,rel);
|
||||
@@ -65,13 +69,17 @@ public class MavenUtil {
|
||||
|
||||
for (String modulePath : (List<String>) project.getModules()) {
|
||||
File moduleFile = new File(new File(basedir, modulePath),"pom.xml");
|
||||
if(!moduleFile.exists()) {
|
||||
listener.getLogger().println(moduleFile+" is referenced from "+project.getFile()+" but it doesn't exist");
|
||||
throw new AbortException();
|
||||
}
|
||||
|
||||
String relativePath = rel;
|
||||
if(relativePath.length()>0) relativePath+='/';
|
||||
relativePath+=modulePath;
|
||||
|
||||
MavenProject child = embedder.readProject(moduleFile);
|
||||
resolveModules(embedder,child,relativePath,relativePathInfo);
|
||||
resolveModules(embedder,child,relativePath,relativePathInfo,listener);
|
||||
modules.add(child);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user