org.apache.maven.plugins.surefire.report.ReportTestCase#org.apache.maven.reporting.MavenReportException源码实例Demo

下面列出了org.apache.maven.plugins.surefire.report.ReportTestCase#org.apache.maven.reporting.MavenReportException 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: repairnator   文件: AbstractRepairMojo.java
public List<String> getFailingTests() {
    List<String> result = new ArrayList<>();

    for (MavenProject mavenProject : reactorProjects) {
        File surefireReportsDirectory = getSurefireReportsDirectory(mavenProject);
        SurefireReportParser parser = new SurefireReportParser(Collections.singletonList(surefireReportsDirectory), Locale.ENGLISH, new NullConsoleLogger());

        try {
            List<ReportTestSuite> testSuites = parser.parseXMLReportFiles();
            for (ReportTestSuite reportTestSuite : testSuites) {
                if (reportTestSuite.getNumberOfErrors()+reportTestSuite.getNumberOfFailures() > 0) {
                    result.add(reportTestSuite.getFullClassName());
                }
            }
        } catch (MavenReportException e) {
            e.printStackTrace();;
        }

    }

    return result;
}
 
protected void doGenerateReport( Locale locale, Sink sink )
    throws MavenReportException
{
    final Map<Property, PropertyVersions> updateSet;
    try
    {
        updateSet = getHelper().getVersionPropertiesMap( getProject(), properties, includeProperties,
                                                         excludeProperties, autoLinkItems );
    }
    catch ( MojoExecutionException e )
    {
        throw new MavenReportException( e.getMessage(), e );
    }
    PropertyUpdatesRenderer renderer =
        new PropertyUpdatesRenderer( sink, getI18n(), getOutputName(), locale, updateSet );
    renderer.render();
}
 
public VersionsHelper getHelper()
    throws MavenReportException
{
    if ( helper == null )
    {
        try
        {
            helper = new DefaultVersionsHelper( artifactFactory, artifactResolver, artifactMetadataSource,
                                                remoteArtifactRepositories, remotePluginRepositories,
                                                localRepository, wagonManager, settings, serverId, rulesUri,
                                                getLog(), session, pathTranslator );
        }
        catch ( MojoExecutionException e )
        {
            throw new MavenReportException( e.getMessage(), e );
        }
    }
    return helper;
}
 
/**
 * {@inheritDoc}
 */
protected void executeReport( Locale locale )
    throws MavenReportException
{
    if ( !skip )
    {
        try
        {
            doGenerateReport( locale, getSink() );
        }
        catch ( MojoExecutionException e )
        {
            throw new MavenReportException( e.getMessage(), e );
        }
    }
}
 
/**
 * Finds the latest version of the specified artifact that matches the version range.
 *
 * @param artifact The artifact.
 * @param versionRange The version range.
 * @param allowingSnapshots <code>null</code> for no override, otherwise the local override to apply.
 * @param usePluginRepositories Use plugin repositories
 * @return The latest version of the specified artifact that matches the specified version range or
 *         <code>null</code> if no matching version could be found.
 * @throws MavenReportException If the artifact metadata could not be found.
 * @since 1.0-alpha-1
 */
protected ArtifactVersion findLatestVersion( Artifact artifact, VersionRange versionRange,
                                             boolean allowingSnapshots, boolean usePluginRepositories )
    throws MavenReportException
{
    boolean includeSnapshots = this.allowSnapshots;
    if ( allowingSnapshots )
    {
        includeSnapshots = true;
    }
    if ( allowingSnapshots )
    {
        includeSnapshots = false;
    }
    try
    {
        final ArtifactVersions artifactVersions =
            getHelper().lookupArtifactVersions( artifact, usePluginRepositories );
        return artifactVersions.getNewestVersion( versionRange, includeSnapshots );
    }
    catch ( ArtifactMetadataRetrievalException e )
    {
        throw new MavenReportException( e.getMessage(), e );
    }
}
 
源代码6 项目: revapi   文件: ReportMojo.java
@Override
protected void executeReport(Locale locale) throws MavenReportException {
    ensureAnalyzed(locale);

    if (skip) {
        return;
    }

    if (oldAPI == null || newAPI == null) {
        getLog().warn("Could not determine the artifacts to compare. If you're comparing the" +
                " currently built version, have you run the package goal?");
        return;
    }

    if (generateSiteReport) {
        Sink sink = getSink();
        ResourceBundle bundle = getBundle(locale);

        ReportTimeReporter reporter =
                analysisResult.getExtensions().getFirstExtension(ReportTimeReporter.class, null);

        startReport(sink, bundle);
        reportBody(reporter, oldAPI, newAPI, sink, bundle);
        endReport(sink);
    }
}
 
源代码7 项目: pitest   文件: PitReportMojo.java
@Override
protected void executeReport(Locale locale) throws MavenReportException {
  this.getLog().debug("PitReportMojo - starting");

  if (!this.reportsDirectory.exists()) {
    throw new PitError("could not find reports directory ["
        + this.reportsDirectory + "]");
  }

  if (!this.reportsDirectory.canRead()) {
    throw new PitError("reports directory [" + this.reportsDirectory
        + "] not readable");
  }

  if (!this.reportsDirectory.isDirectory()) {
    throw new PitError("reports directory [" + this.reportsDirectory
        + "] is actually a file, it must be a directory");
  }

  this.reportGenerationManager.generateSiteReport(this
      .buildReportGenerationContext(locale));

  this.getLog().debug("PitReportMojo - ending");
}
 
源代码8 项目: pitest   文件: AbstractPitAggregationReportMojo.java
@Override
protected void executeReport(final Locale locale)
    throws MavenReportException {
  try {
    final Collection<MavenProject> allProjects = findDependencies();

    final ReportAggregator.Builder reportAggregationBuilder = ReportAggregator
        .builder();

    for (final MavenProject proj : allProjects) {
      addProjectFiles(reportAggregationBuilder, proj);
    }

    final ReportAggregator reportAggregator = reportAggregationBuilder
        .resultOutputStrategy(new DirectoryResultOutputStrategy(
            getReportsDirectory().getAbsolutePath(),
            new UndatedReportDirCreationStrategy()))
        .build();

    reportAggregator.aggregateReport();
  } catch (final Exception e) {
    throw new MavenReportException(e.getMessage(), e);
  }
}
 
/**
 * Generates SCoverage report.
 * 
 * @throws MojoExecutionException if unexpected problem occurs
 */
@Override
public void execute()
    throws MojoExecutionException
{
    if ( !canGenerateReport() )
    {
        getLog().info( "Skipping SCoverage report generation" );
        return;
    }

    try
    {
        RenderingContext context = new RenderingContext( outputDirectory, getOutputName() + ".html" );
        SiteRendererSink sink = new SiteRendererSink( context );
        Locale locale = Locale.getDefault();
        generate( sink, locale );
    }
    catch ( MavenReportException e )
    {
        String prefix = "An error has occurred in " + getName( Locale.ENGLISH ) + " report generation";
        throw new MojoExecutionException( prefix + ": " + e.getMessage(), e );
    }
}
 
源代码10 项目: testgrid   文件: SurefireReporter.java
/**
 * Parses the surefire reports and returns a summarized TestResult object.
 *
 * @param testPlan the testplan
 * @return test result
 */
public TestResult getReport(TestPlan testPlan) {
    TestResult testResult = new TestResult();
    try {
        Path filePath = TestGridUtil.getSurefireReportsDir(testPlan);
        final SurefireReportParser surefireReportParser = new SurefireReportParser(
                Collections.singletonList(filePath.toFile()),
                ENGLISH,
                new NullConsoleLogger());
        final List<ReportTestSuite> reportTestSuites = surefireReportParser.parseXMLReportFiles();
        final Map<String, String> summary = surefireReportParser.getSummary(reportTestSuites);
        testResult.totalTests = summary.get("totalTests");
        testResult.totalFailures = summary.get("totalFailures");
        testResult.totalErrors = summary.get("totalErrors");
        testResult.totalSkipped = summary.get("totalSkipped");

        final List<ReportTestCase> failureDetails = surefireReportParser.getFailureDetails(reportTestSuites);
        testResult.failureTests = getTests(failureDetails, ReportTestCase::hasFailure);
        testResult.errorTests = getTests(failureDetails, ReportTestCase::hasError);

        return testResult;
    } catch (MavenReportException e) {
        logger.warn("Error while processing surefire-reports for " + testPlan.getId() + " for infra combination:"
                + " " + testPlan.getInfraParameters() + ". Continuing processing of other test plans", e);
    }

    return testResult;
}
 
源代码11 项目: webstart   文件: JnlpReportMojo.java
/**
 * {@inheritDoc}
 */
public void executeReport( Locale locale )
        throws MavenReportException
{
    copyJnlpFiles();
    fillReport( locale );
}
 
源代码12 项目: webstart   文件: JnlpReportMojo.java
private void copyJnlpFiles()
        throws MavenReportException
{
    if ( !jnlpSourceDirectory.exists() )
    {
        throw new MavenReportException( "jnlpSourceDirectory does not exist" );
    }
    try
    {
        File destinationDirectory = new File( outputDirectory, siteJnlpDirectory );
        List<File> files = FileUtils.getFiles( jnlpSourceDirectory, "**/*", "" );
        for ( File file : files )
        {
            getLog().debug( "Copying " + file + " to " + destinationDirectory );
            String path = file.getAbsolutePath().substring( jnlpSourceDirectory.getAbsolutePath().length() + 1 );
            File destDir = new File( destinationDirectory, path );
            getLog().debug( "Copying " + file + " to " + destDir );
            if ( file.isDirectory() )
            {
                destDir.mkdirs();
            }
            else
            {
                FileUtils.copyFileToDirectory( file, destDir.getParentFile() );
            }
        }
    }
    catch ( IOException e )
    {
        throw new MavenReportException( "Failed to copy jnlp files", e );
    }
}
 
源代码13 项目: james-project   文件: AbstractMailetdocsReport.java
@Override
protected void executeReport(Locale locale) throws MavenReportException {
    
    getLog().info("Executing Mailets/Matchers Report");

    getSink().head();
    getSink().title();
    getSink().text("Mailet and Matchers Reference");
    getSink().title_();
    getSink().head_();

    getSink().body();

    getSink().section1();
    getSink().sectionTitle1();
    getSink().text("Mailets and Matchers Reference");
    getSink().sectionTitle1_();
    getSink().text("Items marked as Experimental are not yet supported by James; however, you can try them.");
    getSink().section1_();
    
    writeDescriptions();

    getSink().body_();

    getSink().flush();
    getSink().close();
}
 
/** {@inheritDoc} */
@Override
public boolean canGenerateReport()
{
    if ( !skip && !"pom".equals( project.getPackaging() ) )
    {
        SCoverageForkedLifecycleConfigurator.afterForkedLifecycleExit( project, reactorProjects );
    }

    boolean canGenerateNonAggregatedReport = canGenerateNonAggregatedReport();
    boolean canAttachAggregatedReportToSite = canAttachAggregatedReportToSite();

    boolean result = canGenerateNonAggregatedReport || canAttachAggregatedReportToSite; 

    if ( !result && canGenerateAggregatedReport() )
    {
        // last project, but not top-level one
        // generate here, because 'false' must be returned to Maven in order to avoid adding to this module's site
        try
        {
            generateAggregatedReports();
        }
        catch ( MavenReportException e )
        {
            throw new RuntimeException( e );
        }
    }
    return result;
}
 
private void generateReports()
    throws MavenReportException /*, RuntimeException*/
{
    @SuppressWarnings( "unchecked" )
    List<String> sourceDirs = project.getExecutionProject().getCompileSourceRoots();
    List<File> sourceRoots = new ArrayList<File>( sourceDirs.size() );
    for ( String dir: sourceDirs )
    {
        sourceRoots.add( new File( dir ) );
    }

    mkdirs( outputDirectory );
    mkdirs( xmlOutputDirectory );

    File coverageFile = Serializer.coverageFile( dataDirectory );
    getLog().info( String.format( "Reading scoverage instrumentation [%s]...", coverageFile.getAbsolutePath() ) );
    Coverage coverage = Serializer.deserialize( coverageFile );

    getLog().info( String.format( "Reading scoverage measurements [%s*]...",
                                  new File( dataDirectory, Constants.MeasurementsPrefix() ).getAbsolutePath() ) );
    List<File> measurementFiles = Arrays.asList( IOUtils.findMeasurementFiles( dataDirectory ) );
    scala.collection.Set<Object> measurements = IOUtils.invoked( JavaConverters.asScalaBuffer( measurementFiles ) );
    coverage.apply( measurements );

    getLog().info( "Generating coverage reports..." );
    writeReports( coverage, sourceRoots, xmlOutputDirectory, xmlOutputDirectory, outputDirectory );
    getLog().info( "Coverage reports completed." );
}
 
private void mkdirs( File directory )
    throws MavenReportException
{
    if ( !directory.exists() && !directory.mkdirs() )
    {
        throw new MavenReportException( String.format( "Cannot create \"%s\" directory ",
                                                       directory.getAbsolutePath() ) );
    }
    else if ( directory.exists() && !directory.isDirectory() )
    {
        throw new MavenReportException( String.format( "Directory \"%s\" exists but is not a directory ",
                                                       directory.getAbsolutePath() ) );
    }
}
 
源代码17 项目: wisdom   文件: UnitTestMojo.java
/**
 * Notifies the watcher that a new file is created. It selects and executes the test. Failures and errors are
 * reported in the thrown {@link org.wisdom.maven.WatchingException}.
 *
 * @param file is the file.
 * @return return {@code true}
 * @throws org.wisdom.maven.WatchingException if the test execution failed.
 */
@Override
public boolean fileCreated(File file) throws WatchingException {
    // Check selection policy
    String testParameter = null;
    if (testSelectionPolicy == TestSelectionPolicy.SELECTIVE) {
        // The test selection is done using the -Dtest parameter from surefire
        // We should also take care that the changed file is not a 'test', in that case, we run only this one.
        final String filename = file.getName().substring(0, file.getName().lastIndexOf("."));
        if (filename.startsWith("Test")  || filename.endsWith("Test")  || filename.endsWith("TestCase")) {
            testParameter = filename;
        } else {
            // It's a business class
            // Be aware of #365, the selection must select only unit tests, so the expression should be
            // TestFileName*,*FileNameTest*
            // The *FileNameTestCase case can be ignored (included by the second expression)
            testParameter = "Test" + filename + "*,*" + filename + "Test*";
        }
    }

    try {
        execute(testParameter);
        return true;
    } catch (MojoExecutionException e) {
        getLog().debug("An error occurred while executing Surefire", e);
        // Compute the Watching Exception content.
        StringBuilder message = new StringBuilder();
        SurefireReportParser parser = new SurefireReportParser(ImmutableList.of(reports), Locale.ENGLISH);
        try {
            computeTestFailureMessageFromReports(message, parser);
            throw new WatchingException("Unit Test Failures", message.toString(), file, e);
        } catch (MavenReportException reportException) {
            // Cannot read the reports.
            throw new WatchingException("Unit Test Failures", file, reportException);
        }}
}
 
源代码18 项目: wisdom   文件: UnitTestMojo.java
private static void computeTestFailureMessageFromReports(StringBuilder message, SurefireReportParser parser)
        throws MavenReportException {
    List<ReportTestSuite> suites = parser.parseXMLReportFiles();
    Map<String, String> summary = parser.getSummary(suites);
    message
            .append(summary.get("totalTests"))
            .append(" tests, ")
            .append(summary.get("totalErrors"))
            .append(" errors, ")
            .append(summary.get("totalFailures"))
            .append(" failures, ")
            .append(summary.get("totalSkipped"))
            .append(" skipped ")
            .append("(executed in ")
            .append(summary.get("totalElapsedTime"))
            .append("s)<br/><ul>");
    for (ReportTestSuite suite : suites) {
        if (suite.getNumberOfErrors() > 0 || suite.getNumberOfFailures() > 0) {
            for (ReportTestCase tc : suite.getTestCases()) {
                if (tc.getFailure() != null
                        && !"skipped".equalsIgnoreCase((String) tc.getFailure().get("message"))) {
                    message
                            .append("<li><em>")
                            .append(tc.getFullName())
                            .append("</em> failed: ")
                            .append(tc.getFailure().get("message"))
                            .append("</li>");
                }
            }
        }
    }
    message.append("</ul>");
}
 
/**
 * generates an empty report in case there are no sources to generate a report with
 *
 * @param locale the locale to generate the report for.
 * @param sink the report formatting tool
 */
protected void doGenerateReport( Locale locale, Sink sink )
    throws MavenReportException
{
    Set<Plugin> pluginManagement = new TreeSet<>( new PluginComparator() );
    if ( haveBuildPluginManagementPlugins() )
    {
        pluginManagement.addAll( getProject().getBuild().getPluginManagement().getPlugins() );
    }

    Set<Plugin> plugins = new TreeSet<>( new PluginComparator() );
    if ( haveBuildPlugins() )
    {
        plugins.addAll( getProject().getBuild().getPlugins() );
    }

    plugins = removePluginManagment( plugins, pluginManagement );

    try
    {
        Map<Plugin, PluginUpdatesDetails> pluginUpdates =
            getHelper().lookupPluginsUpdates( plugins, getAllowSnapshots() );
        Map<Plugin, PluginUpdatesDetails> pluginManagementUpdates =
            getHelper().lookupPluginsUpdates( pluginManagement, getAllowSnapshots() );
        for ( String format : formats )
        {
            if ( "html".equals( format ) )
            {
                PluginUpdatesRenderer renderer =
                    new PluginUpdatesRenderer( sink, getI18n(), getOutputName(), locale, pluginUpdates,
                                               pluginManagementUpdates );
                renderer.render();
            }
            else if ( "xml".equals( format ) )
            {
                File outputDir = new File(getProject().getBuild().getDirectory());
                if (!outputDir.exists())
                {
                    outputDir.mkdirs();
                }
                String outputFile =
                    outputDir.getAbsolutePath() + File.separator + getOutputName() + ".xml";
                PluginUpdatesXmlRenderer xmlGenerator =
                    new PluginUpdatesXmlRenderer( pluginUpdates, pluginManagementUpdates, outputFile );
                xmlGenerator.render();
            }
        }
    }
    catch ( InvalidVersionSpecificationException | ArtifactMetadataRetrievalException e )
    {
        throw new MavenReportException( e.getMessage(), e );
    }
}
 
源代码20 项目: aspectj-maven-plugin   文件: AjcReportMojo.java
/**
 * Executes this ajdoc-report generation.
 */
@SuppressWarnings( "unchecked" )
protected void executeReport( Locale locale )
    throws MavenReportException
{
    getLog().info( "Starting generating ajdoc" );

    project.getCompileSourceRoots().add( basedir.getAbsolutePath() + "/" + aspectDirectory );
    project.getTestCompileSourceRoots().add( basedir.getAbsolutePath() + "/" + testAspectDirectory );

    List<String> arguments = new ArrayList<String>();
    // Add classpath
    arguments.add( "-classpath" );
    arguments.add( AjcHelper.createClassPath( project, pluginArtifacts, getClasspathDirectories() ) );

    arguments.addAll( ajcOptions );

    Set<String> includes;
    try
    {
        if ( null != ajdtBuildDefFile )
        {
            includes = AjcHelper.getBuildFilesForAjdtFile( ajdtBuildDefFile, basedir );
        }
        else
        {
            includes = AjcHelper.getBuildFilesForSourceDirs( getSourceDirectories(), this.includes, this.excludes );
        }
    }
    catch ( MojoExecutionException e )
    {
        throw new MavenReportException( "AspectJ Report failed", e );
    }

    // add target dir argument
    arguments.add( "-d" );
    arguments.add( StringUtils.replace( getOutputDirectory(), "//", "/" ) );

    arguments.addAll( includes );

    if ( getLog().isDebugEnabled() )
    {
        StringBuilder command = new StringBuilder( "Running : ajdoc " );
        for ( String argument : arguments )
        {
            command.append( ' ' ).append( argument );
        }
        getLog().debug( command );
    }

    // There seems to be a difference in classloading when calling 'mvn site' or 'mvn aspectj:aspectj-report'.
    // When calling mvn site, without the contextClassLoader set, you might see the next message:
    // javadoc: error - Cannot find doclet class com.sun.tools.doclets.standard.Standard
    ClassLoader oldContextClassLoader = Thread.currentThread().getContextClassLoader();
    try
    {
        Thread.currentThread().setContextClassLoader( this.getClass().getClassLoader() );

        // MASPECTJ-11: Make the ajdoc use the ${project.build.directory} directory for its intermediate folder.
        // The argument should be the absolute path to the parent directory of the "ajdocworkingdir" folder.
        Main.setOutputWorkingDir( buildDirectory.getAbsolutePath() );

        // Now produce the JavaDoc.
        Main.main( (String[]) arguments.toArray( new String[0] ) );
    }
    finally
    {
        Thread.currentThread().setContextClassLoader( oldContextClassLoader );
    }

}
 
源代码21 项目: revapi   文件: ReportAggregateMojo.java
@Override
protected void executeReport(Locale locale) throws MavenReportException {
    if (skip) {
        return;
    }

    if (!canGenerateReport()) {
        return;
    }

    List<MavenProject> dependents = mavenSession.getProjectDependencyGraph().getDownstreamProjects(project, true);
    Collections.sort(dependents, (a, b) -> {
        String as = a.getArtifact().toString();
        String bs = b.getArtifact().toString();
        return as.compareTo(bs);
    });

    Map<MavenProject, ProjectVersions> projectVersions = dependents.stream().collect(
            Collectors.toMap(Function.identity(), this::getRunConfig));
    projectVersions.put(project, getRunConfig(project));

    ResourceBundle messages = getBundle(locale);
    Sink sink = getSink();

    if (generateSiteReport) {
        startReport(sink, messages);
    }

    try {
        Analyzer topAnalyzer = prepareAnalyzer(null, project, locale, projectVersions.get(project));

        Revapi sharedRevapi = topAnalyzer == null ? null : topAnalyzer.getRevapi();

        for (MavenProject p : dependents) {
            Analyzer projectAnalyzer = prepareAnalyzer(sharedRevapi, p, locale, projectVersions.get(p));
            if (projectAnalyzer != null) {
                try (AnalysisResult res = projectAnalyzer.analyze()) {
                    res.throwIfFailed();

                    ReportTimeReporter reporter =
                            res.getExtensions().getFirstExtension(ReportTimeReporter.class, null);

                    if (generateSiteReport && reporter != null) {
                        reportBody(reporter, projectAnalyzer.getResolvedOldApi(),
                                projectAnalyzer.getResolvedNewApi(), sink, messages);
                    }
                }
            }
        }

        if (generateSiteReport) {
            endReport(sink);
        }
    } catch (Exception e) {
        throw new MavenReportException("Failed to generate the report.", e);
    }
}
 
private void generateAggregatedReports()
    throws MavenReportException
{
    List<File> scoverageDataDirs = new ArrayList<File>();
    List<File> sourceRoots = new ArrayList<File>();
    MavenProject topLevelModule = null;
    for ( MavenProject module : reactorProjects )
    {
        if ( module.isExecutionRoot() )
        {
            topLevelModule = module;
        }
        else if ( !module.getPackaging().equals( "pom" ) )
        {
            File scoverageDataDir = rebase( dataDirectory, module );
            if ( scoverageDataDir.isDirectory() )
            {
                scoverageDataDirs.add( scoverageDataDir );

                File sourceRootsFile = new File( scoverageDataDir, "source.roots" );
                if ( sourceRootsFile.isFile() )
                {
                    try
                    {
                        BufferedReader r = new BufferedReader( new InputStreamReader(
                                new FileInputStream( sourceRootsFile ), "UTF-8" ) );
                        try
                        {
                            String path = r.readLine();
                            while ( path != null )
                            {
                                sourceRoots.add( new File( path ) );
                                path = r.readLine();
                            }
                        }
                        finally
                        {
                            r.close();
                        }
                    }
                    catch ( IOException e )
                    {
                        throw new MavenReportException( "...", e );
                    }
                }
            }
        }
    }

    /* Empty report must be generated or top-level site will contain invalid link to non-existent Scoverage report
    if ( scoverageDataDirs.isEmpty() )
    {
        getLog().info( "No subproject data to aggregate, skipping SCoverage report generation" );
        return;
    }*/

    if ( getLog().isDebugEnabled() && scoverageDataDirs.size() > 0 )
    {
        getLog().debug( String.format( "Found %d subproject subproject scoverage data directories:",
                scoverageDataDirs.size() ) );
        for ( File dataDir: scoverageDataDirs )
        {
            getLog().debug( String.format( "- %s", dataDir.getAbsolutePath() ) );
        }
    }
    else
    {
        getLog().info( String.format( "Found %d subproject scoverage data directories.",
                scoverageDataDirs.size() ) );
    }

    File topLevelModuleOutputDirectory = rebase( outputDirectory, topLevelModule );
    File topLevelModuleXmlOutputDirectory = rebase( xmlOutputDirectory, topLevelModule );

    mkdirs( topLevelModuleOutputDirectory );
    mkdirs( topLevelModuleXmlOutputDirectory );

    Coverage coverage =
        CoverageAggregator.aggregatedCoverage( JavaConverters.asScalaBuffer( scoverageDataDirs ).toSeq() );

    getLog().info( "Generating coverage aggregated reports..." );
    writeReports( coverage, sourceRoots, topLevelModuleXmlOutputDirectory, topLevelModuleXmlOutputDirectory,
                  topLevelModuleOutputDirectory );
    getLog().info( "Coverage aggregated reports completed." );
}
 
/**
 * generates the report.
 *
 * @param locale the locale to generate the report for.
 * @param sink the report formatting tool.
 * @throws MavenReportException when things go wrong.
 * @throws MojoExecutionException if something goes wrong.
 */
protected abstract void doGenerateReport( Locale locale, Sink sink )
    throws MavenReportException, MojoExecutionException;