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);
 }
  public void generate(Sink sink, Locale locale) throws MavenReportException {
    try {
      if (!canGenerateReport()) {
        getLog().warn("No source files found");
        return;
      }

      File reportOutputDir = getReportOutputDirectory();
      if (!reportOutputDir.exists()) {
        reportOutputDir.mkdirs();
      }
      if (StringUtils.isNotEmpty(vscaladocVersion)) {
        scaladocClassName = "org.scala_tools.vscaladoc.Main";
        BasicArtifact artifact = new BasicArtifact();
        artifact.artifactId = "vscaladoc";
        artifact.groupId = "org.scala-tools";
        artifact.version = vscaladocVersion;
        dependencies = new BasicArtifact[] {artifact};
      }

      List<File> sources = findSourceFiles();
      if (sources.size() > 0) {
        JavaMainCaller jcmd = getScalaCommand();
        jcmd.addOption("-d", reportOutputDir.getAbsolutePath());
        for (File x : sources) {
          jcmd.addArgs(FileUtils.pathOf(x, useCanonicalPath));
        }
        jcmd.run(displayCmd);
      }
      if (forceAggregate) {
        aggregate(project);
      } else {
        // Mojo could not be run from parent after all its children
        // So the aggregation will be run after the last child
        tryAggregateUpper(project);
      }

    } catch (MavenReportException exc) {
      throw exc;
    } catch (RuntimeException exc) {
      throw exc;
    } catch (Exception exc) {
      throw new MavenReportException("wrap: " + exc.getMessage(), exc);
    }
  }