Package org.apache.maven.reporting
Class AbstractMavenReport
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- org.apache.maven.reporting.AbstractMavenReport
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo,org.apache.maven.reporting.MavenMultiPageReport,org.apache.maven.reporting.MavenReport
public abstract class AbstractMavenReport extends org.apache.maven.plugin.AbstractMojo implements org.apache.maven.reporting.MavenMultiPageReportThe basis for a Maven report which can be generated both as part of a site generation or as a direct standalone goal invocation. Both invocations are delegated toabstract executeReport( Locale )from:- Mojo's
execute()method, see maven-plugin-api - MavenMultiPageReport's
generate( Sink, SinkFactory, Locale ), see maven-reporting-api
- Since:
- 2.0
- Version:
- $Id: AbstractMavenReport.java 1777736 2017-01-06 23:54:39Z michaelo $
- See Also:
Mojo.execute(), from maven-plugin-api,MavenMultiPageReport.generate( Sink, SinkFactory, Locale ), from maven-reporting-api,abstract executeReport( Locale )
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringinputEncodingSpecifies the input encoding.protected java.io.FileoutputDirectoryThe output directory for the report.private java.lang.StringoutputEncodingSpecifies the output encoding.protected org.apache.maven.project.MavenProjectprojectThe Maven Project.private java.io.FilereportOutputDirectoryThe current report output directory to useprivate org.apache.maven.doxia.sink.SinksinkThe current sink to useprivate org.apache.maven.doxia.sink.SinkFactorysinkFactoryThe sink factory to useprotected org.apache.maven.doxia.siterenderer.RenderersiteRendererDoxia Site Renderer component.
-
Constructor Summary
Constructors Constructor Description AbstractMavenReport()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleancanGenerateReport()protected voidcloseReport()Actions when closing the report.voidexecute()This method is called when the report generation is invoked directly as a standalone Mojo.protected abstract voidexecuteReport(java.util.Locale locale)Execute the generation of the report.voidgenerate(org.apache.maven.doxia.sink.Sink sink, java.util.Locale locale)Deprecated.usegenerate(Sink, SinkFactory, Locale)instead.voidgenerate(org.apache.maven.doxia.sink.Sink sink, org.apache.maven.doxia.sink.SinkFactory sinkFactory, java.util.Locale locale)This method is called when the report generation is invoked by maven-site-plugin.voidgenerate(org.codehaus.doxia.sink.Sink sink, java.util.Locale locale)Deprecated.usegenerate(Sink, SinkFactory, Locale)instead.java.lang.StringgetCategoryName()protected java.lang.StringgetInputEncoding()Gets the input files encoding.protected java.lang.StringgetOutputDirectory()protected java.lang.StringgetOutputEncoding()Gets the effective reporting output files encoding.protected org.apache.maven.project.MavenProjectgetProject()java.io.FilegetReportOutputDirectory()org.apache.maven.doxia.sink.SinkgetSink()org.apache.maven.doxia.sink.SinkFactorygetSinkFactory()protected org.apache.maven.doxia.siterenderer.RenderergetSiteRenderer()private java.util.Map<java.lang.String,java.lang.Object>getTemplateProperties()create template properties like done in maven-site-plugin'sAbstractSiteRenderingMojo.createSiteRenderingContext( Locale )booleanisExternalReport()voidsetReportOutputDirectory(java.io.File reportOutputDirectory)-
Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
-
-
-
Field Detail
-
outputDirectory
@Parameter(defaultValue="${project.reporting.outputDirectory}", readonly=true, required=true) protected java.io.File outputDirectoryThe output directory for the report. Note that this parameter is only evaluated if the goal is run directly from the command line. If the goal is run indirectly as part of a site generation, the output directory configured in the Maven Site Plugin is used instead.
-
project
@Parameter(defaultValue="${project}", readonly=true, required=true) protected org.apache.maven.project.MavenProject projectThe Maven Project.
-
inputEncoding
@Parameter(property="encoding", defaultValue="${project.build.sourceEncoding}", readonly=true) private java.lang.String inputEncodingSpecifies the input encoding.
-
outputEncoding
@Parameter(property="outputEncoding", defaultValue="${project.reporting.outputEncoding}", readonly=true) private java.lang.String outputEncodingSpecifies the output encoding.
-
siteRenderer
@Component protected org.apache.maven.doxia.siterenderer.Renderer siteRenderer
Doxia Site Renderer component.
-
sink
private org.apache.maven.doxia.sink.Sink sink
The current sink to use
-
sinkFactory
private org.apache.maven.doxia.sink.SinkFactory sinkFactory
The sink factory to use
-
reportOutputDirectory
private java.io.File reportOutputDirectory
The current report output directory to use
-
-
Method Detail
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionExceptionThis method is called when the report generation is invoked directly as a standalone Mojo.- Specified by:
executein interfaceorg.apache.maven.plugin.Mojo- Throws:
org.apache.maven.plugin.MojoExecutionException- if an error occurs when generating the report- See Also:
org.apache.maven.plugins.site.ReportDocumentRender,Mojo.execute()
-
getTemplateProperties
private java.util.Map<java.lang.String,java.lang.Object> getTemplateProperties()
create template properties like done in maven-site-plugin'sAbstractSiteRenderingMojo.createSiteRenderingContext( Locale )- Returns:
- properties
-
generate
public void generate(org.codehaus.doxia.sink.Sink sink, java.util.Locale locale) throws org.apache.maven.reporting.MavenReportExceptionDeprecated.usegenerate(Sink, SinkFactory, Locale)instead.Generate a report.- Specified by:
generatein interfaceorg.apache.maven.reporting.MavenReport- Parameters:
sink- the sink to use for the generation.locale- the wanted locale to generate the report, could be null.- Throws:
org.apache.maven.reporting.MavenReportException- if any
-
generate
public void generate(org.apache.maven.doxia.sink.Sink sink, java.util.Locale locale) throws org.apache.maven.reporting.MavenReportExceptionDeprecated.usegenerate(Sink, SinkFactory, Locale)instead.Generate a report.- Parameters:
sink-locale-- Throws:
org.apache.maven.reporting.MavenReportException- See Also:
org.apache.maven.reporting.MavenReport#generate(org.apache.maven.doxia.sink.Sink, java.util.Locale)
-
generate
public void generate(org.apache.maven.doxia.sink.Sink sink, org.apache.maven.doxia.sink.SinkFactory sinkFactory, java.util.Locale locale) throws org.apache.maven.reporting.MavenReportExceptionThis method is called when the report generation is invoked by maven-site-plugin.- Specified by:
generatein interfaceorg.apache.maven.reporting.MavenMultiPageReport- Parameters:
sink-sinkFactory-locale-- Throws:
org.apache.maven.reporting.MavenReportException
-
getCategoryName
public java.lang.String getCategoryName()
- Specified by:
getCategoryNamein interfaceorg.apache.maven.reporting.MavenReport- Returns:
- CATEGORY_PROJECT_REPORTS
-
getReportOutputDirectory
public java.io.File getReportOutputDirectory()
- Specified by:
getReportOutputDirectoryin interfaceorg.apache.maven.reporting.MavenReport
-
setReportOutputDirectory
public void setReportOutputDirectory(java.io.File reportOutputDirectory)
- Specified by:
setReportOutputDirectoryin interfaceorg.apache.maven.reporting.MavenReport
-
getOutputDirectory
protected java.lang.String getOutputDirectory()
-
getProject
protected org.apache.maven.project.MavenProject getProject()
-
getSiteRenderer
protected org.apache.maven.doxia.siterenderer.Renderer getSiteRenderer()
-
getInputEncoding
protected java.lang.String getInputEncoding()
Gets the input files encoding.- Returns:
- The input files encoding, never
null.
-
getOutputEncoding
protected java.lang.String getOutputEncoding()
Gets the effective reporting output files encoding.- Returns:
- The effective reporting output file encoding, never
null.
-
closeReport
protected void closeReport()
Actions when closing the report.
-
getSink
public org.apache.maven.doxia.sink.Sink getSink()
- Returns:
- the sink used
-
getSinkFactory
public org.apache.maven.doxia.sink.SinkFactory getSinkFactory()
- Returns:
- the sink factory used
-
isExternalReport
public boolean isExternalReport()
- Specified by:
isExternalReportin interfaceorg.apache.maven.reporting.MavenReport- Returns:
- false by default.
- See Also:
MavenReport.isExternalReport()
-
canGenerateReport
public boolean canGenerateReport()
- Specified by:
canGenerateReportin interfaceorg.apache.maven.reporting.MavenReport
-
executeReport
protected abstract void executeReport(java.util.Locale locale) throws org.apache.maven.reporting.MavenReportExceptionExecute the generation of the report.- Parameters:
locale- the wanted locale to return the report's description, could benull.- Throws:
org.apache.maven.reporting.MavenReportException- if any
-
-