コード例 #1
0
 protected void aggregate(MavenProject parent) throws Exception {
   List<MavenProject> modules = parent.getCollectedProjects();
   File dest = new File(parent.getReporting().getOutputDirectory() + "/" + outputDirectory);
   getLog().info("start aggregation into " + dest);
   StringBuilder mpath = new StringBuilder();
   for (MavenProject module : modules) {
     if ("pom".equals(module.getPackaging().toLowerCase())) {
       continue;
     }
     if (aggregateDirectOnly && module.getParent() != parent) {
       continue;
     }
     File subScaladocPath =
         new File(module.getReporting().getOutputDirectory() + "/" + outputDirectory)
             .getAbsoluteFile();
     // System.out.println(" -> " + project.getModulePathAdjustment(module)  +" // " +
     // subScaladocPath + " // " + module.getBasedir() );
     if (subScaladocPath.exists()) {
       mpath.append(subScaladocPath).append(File.pathSeparatorChar);
     }
   }
   if (mpath.length() != 0) {
     getLog().info("aggregate vscaladoc from : " + mpath);
     JavaMainCaller jcmd = getScalaCommand();
     jcmd.addOption("-d", dest.getAbsolutePath());
     jcmd.addOption("-aggregate", mpath.toString());
     jcmd.run(displayCmd);
   } else {
     getLog().warn("no vscaladoc to aggregate");
   }
   tryAggregateUpper(parent);
 }
コード例 #2
0
  /**
   * Loads the dependency tree for the project via {@link #loadDependencyTree(MavenProject)} and
   * then uses the {@link DependencyNodeVisitor} to load the license data. If {@link #aggregating}
   * is enabled the method recurses on each child module.
   */
  @SuppressWarnings("unchecked")
  protected void parseProject(MavenProject project, DependencyNodeVisitor visitor)
      throws MojoExecutionException, MojoFailureException {
    final Log logger = this.getLog();
    logger.info("Parsing Dependencies for: " + project.getName());

    // Load and parse immediate dependencies
    final DependencyNode tree = this.loadDependencyTree(project);
    tree.accept(visitor);

    // If not including child deps don't recurse on modules
    if (!this.includeChildDependencies) {
      return;
    }

    // No child modules, return
    final List<MavenProject> collectedProjects = project.getCollectedProjects();
    if (collectedProjects == null) {
      return;
    }

    // Find all sub-modules for the project
    for (final MavenProject moduleProject : collectedProjects) {
      if (this.isExcluded(moduleProject, project.getArtifactId())) {
        continue;
      }

      this.parseProject(moduleProject, visitor);
    }
  }
コード例 #3
0
 protected void tryAggregateUpper(MavenProject prj) throws Exception {
   if (prj != null && prj.hasParent() && canAggregate()) {
     MavenProject parent = prj.getParent();
     List<MavenProject> modules = parent.getCollectedProjects();
     if ((modules.size() > 1) && prj.equals(modules.get(modules.size() - 1))) {
       aggregate(parent);
     }
   }
 }