List of usage examples for org.apache.maven.project MavenProject setCollectedProjects
public void setCollectedProjects(List<MavenProject> collectedProjects)
From source file:hudson.gridmaven.MavenUtil.java
License:Open Source License
/** * @deprecated MavenEmbedder has now a method to read all projects * Recursively resolves module POMs that are referenced from * the given {@link MavenProject} and parses them into * {@link MavenProject}s./*from ww w.ja v a 2 s . c o m*/ * * @param rel * Used to compute the relative path. Pass in "" to begin. * @param relativePathInfo * 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. * @throws MavenEmbedderException */ public static void resolveModules(MavenEmbedder embedder, MavenProject project, String rel, Map<MavenProject, String> relativePathInfo, BuildListener listener, boolean nonRecursive) throws ProjectBuildingException, AbortException, MavenEmbedderException { File basedir = project.getFile().getParentFile(); relativePathInfo.put(project, rel); List<MavenProject> modules = new ArrayList<MavenProject>(); if (!nonRecursive) { for (String modulePath : project.getModules()) { if (Util.fixEmptyAndTrim(modulePath) != null) { File moduleFile = new File(basedir, modulePath); if (moduleFile.exists() && moduleFile.isDirectory()) { moduleFile = new File(basedir, modulePath + "/pom.xml"); } if (!moduleFile.exists()) throw new AbortException( moduleFile + " is referenced from " + project.getFile() + " but it doesn't exist"); String relativePath = rel; if (relativePath.length() > 0) relativePath += '/'; relativePath += modulePath; MavenProject child = embedder.readProject(moduleFile); resolveModules(embedder, child, relativePath, relativePathInfo, listener, nonRecursive); modules.add(child); } } } project.setCollectedProjects(modules); }