Search in sources :

Example 1 with MavenReportExecutor

use of org.apache.maven.reporting.exec.MavenReportExecutor in project maven-plugins by apache.

the class AbstractSiteRenderingMojo method getReports.

protected List<MavenReportExecution> getReports() throws MojoExecutionException {
    List<MavenReportExecution> allReports;
    if (isMaven3OrMore()) {
        // Maven 3
        MavenReportExecutorRequest mavenReportExecutorRequest = new MavenReportExecutorRequest();
        mavenReportExecutorRequest.setLocalRepository(localRepository);
        mavenReportExecutorRequest.setMavenSession(mavenSession);
        mavenReportExecutorRequest.setProject(project);
        mavenReportExecutorRequest.setReportPlugins(reportingPlugins);
        MavenReportExecutor mavenReportExecutor;
        try {
            mavenReportExecutor = (MavenReportExecutor) container.lookup(MavenReportExecutor.class.getName());
        } catch (ComponentLookupException e) {
            throw new MojoExecutionException("could not get MavenReportExecutor component", e);
        }
        allReports = mavenReportExecutor.buildMavenReports(mavenReportExecutorRequest);
    } else {
        // Maven 2
        allReports = new ArrayList<MavenReportExecution>(reports.size());
        for (MavenReport report : reports) {
            allReports.add(new MavenReportExecution(report));
        }
    }
    // filter out reports that can't be generated
    List<MavenReportExecution> reportExecutions = new ArrayList<MavenReportExecution>(allReports.size());
    for (MavenReportExecution exec : allReports) {
        if (exec.canGenerateReport()) {
            reportExecutions.add(exec);
        }
    }
    return reportExecutions;
}
Also used : MavenReportExecution(org.apache.maven.reporting.exec.MavenReportExecution) MavenReport(org.apache.maven.reporting.MavenReport) MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) ArrayList(java.util.ArrayList) MavenReportExecutor(org.apache.maven.reporting.exec.MavenReportExecutor) ComponentLookupException(org.codehaus.plexus.component.repository.exception.ComponentLookupException) MavenReportExecutorRequest(org.apache.maven.reporting.exec.MavenReportExecutorRequest)

Example 2 with MavenReportExecutor

use of org.apache.maven.reporting.exec.MavenReportExecutor in project maven-plugins by apache.

the class PdfMojo method getReports.

protected List<MavenReportExecution> getReports() throws MojoExecutionException {
    if (isMaven3OrMore()) {
        MavenReportExecutorRequest mavenReportExecutorRequest = new MavenReportExecutorRequest();
        mavenReportExecutorRequest.setLocalRepository(localRepository);
        mavenReportExecutorRequest.setMavenSession(session);
        mavenReportExecutorRequest.setProject(project);
        mavenReportExecutorRequest.setReportPlugins(reportPlugins);
        MavenReportExecutor mavenReportExecutor;
        try {
            mavenReportExecutor = (MavenReportExecutor) container.lookup(MavenReportExecutor.class.getName());
        } catch (ComponentLookupException e) {
            throw new MojoExecutionException("could not get MavenReportExecutor component", e);
        }
        return mavenReportExecutor.buildMavenReports(mavenReportExecutorRequest);
    }
    List<MavenReportExecution> reportExecutions = new ArrayList<MavenReportExecution>(reports.length);
    for (MavenReport report : reports) {
        if (report.canGenerateReport()) {
            reportExecutions.add(new MavenReportExecution(report));
        }
    }
    return reportExecutions;
}
Also used : MavenReportExecution(org.apache.maven.reporting.exec.MavenReportExecution) MavenReport(org.apache.maven.reporting.MavenReport) MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) ArrayList(java.util.ArrayList) MavenReportExecutor(org.apache.maven.reporting.exec.MavenReportExecutor) ComponentLookupException(org.codehaus.plexus.component.repository.exception.ComponentLookupException) MavenReportExecutorRequest(org.apache.maven.reporting.exec.MavenReportExecutorRequest)

Aggregations

ArrayList (java.util.ArrayList)2 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)2 MavenReport (org.apache.maven.reporting.MavenReport)2 MavenReportExecution (org.apache.maven.reporting.exec.MavenReportExecution)2 MavenReportExecutor (org.apache.maven.reporting.exec.MavenReportExecutor)2 MavenReportExecutorRequest (org.apache.maven.reporting.exec.MavenReportExecutorRequest)2 ComponentLookupException (org.codehaus.plexus.component.repository.exception.ComponentLookupException)2