Search in sources :

Example 6 with MavenReportExecution

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

the class SiteMojo method execute.

/**
     * {@inheritDoc} Generate the project site
     * <p/>
     * throws MojoExecutionException if any
     *
     * @see org.apache.maven.plugin.Mojo#execute()
     */
public void execute() throws MojoExecutionException, MojoFailureException {
    if (skip) {
        getLog().info("maven.site.skip = true: Skipping site generation");
        return;
    }
    if (getLog().isDebugEnabled()) {
        getLog().debug("executing Site Mojo");
    }
    checkInputEncoding();
    List<MavenReportExecution> reports;
    if (generateReports) {
        reports = getReports();
    } else {
        reports = Collections.emptyList();
    }
    try {
        List<Locale> localesList = getLocales();
        // Default is first in the list
        Locale defaultLocale = localesList.get(0);
        Locale.setDefault(defaultLocale);
        for (Locale locale : localesList) {
            renderLocale(locale, reports);
        }
    } catch (RendererException e) {
        throw new MojoExecutionException(e.getMessage(), e);
    } catch (IOException e) {
        throw new MojoExecutionException("Error during site generation", e);
    }
}
Also used : Locale(java.util.Locale) MavenReportExecution(org.apache.maven.reporting.exec.MavenReportExecution) RendererException(org.apache.maven.doxia.siterenderer.RendererException) MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) IOException(java.io.IOException)

Aggregations

MavenReportExecution (org.apache.maven.reporting.exec.MavenReportExecution)6 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)4 MavenReport (org.apache.maven.reporting.MavenReport)4 ArrayList (java.util.ArrayList)3 DocumentRenderer (org.apache.maven.doxia.siterenderer.DocumentRenderer)3 SiteRenderingContext (org.apache.maven.doxia.siterenderer.SiteRenderingContext)3 File (java.io.File)2 IOException (java.io.IOException)2 Locale (java.util.Locale)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 FileNotFoundException (java.io.FileNotFoundException)1 FileOutputStream (java.io.FileOutputStream)1 InputStream (java.io.InputStream)1 HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1 DoxiaDocumentRenderer (org.apache.maven.doxia.siterenderer.DoxiaDocumentRenderer)1 RendererException (org.apache.maven.doxia.siterenderer.RendererException)1 RenderingContext (org.apache.maven.doxia.siterenderer.RenderingContext)1