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.MavenMultiPageReport
The 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 to
abstract executeReport( Locale )
from:
- Mojo's
execute()
method, see maven-plugin-api - MavenMultiPageReport's
generate( Sink, SinkFactory, Locale )
, see maven-reporting-api
- Since:
- 2.0
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate org.codehaus.plexus.PlexusContainer
private String
Specifies the input encoding.protected String
The locale to use when the report generation is invoked directly as a standalone Mojo.protected org.apache.maven.plugin.MojoExecution
The mojo executionprotected File
The shared output directory for the report.private String
Specifies the output encoding.protected String
The report output format: null by default, to represent a site, but can be configured to a Doxia Sink id.protected String
Timestamp for reproducible output archive entries, either formatted as ISO 8601yyyy-MM-dd'T'HH:mm:ssXXX
or as an int representing seconds since the epoch (like SOURCE_DATE_EPOCH).protected org.apache.maven.project.MavenProject
The Maven Project.protected List
<org.apache.maven.project.MavenProject> The reactor projects.protected List
<org.eclipse.aether.repository.RemoteRepository> Remote project repositories used for the project.private File
The current shared report output directory to useprotected org.eclipse.aether.RepositorySystemSession
The repository system session.private org.apache.maven.doxia.sink.Sink
The current sink to useprivate org.apache.maven.doxia.sink.SinkFactory
The sink factory to useprotected File
Directory containing thesite.xml
file.protected org.apache.maven.doxia.siterenderer.Renderer
Doxia Site Renderer component.protected org.apache.maven.doxia.tools.SiteTool
SiteTool.Fields inherited from interface org.apache.maven.reporting.MavenReport
CATEGORY_PROJECT_INFORMATION, CATEGORY_PROJECT_REPORTS, ROLE
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
protected void
Actions when closing the report.protected String
constructXrefLocation
(File location, boolean test) Contructs the (Test) Source XRef location relative to thegetReportOutputDirectory()
withgetXrefLocation(File, boolean)
.private org.apache.maven.doxia.siterenderer.SiteRenderingContext
createSiteRenderingContext
(Locale locale) final void
execute()
This method is called when the report generation is invoked directly as a standalone Mojo.protected abstract void
executeReport
(Locale locale) Execute the generation of the report.void
Deprecated.void
generate
(org.apache.maven.doxia.sink.Sink sink, org.apache.maven.doxia.sink.SinkFactory sinkFactory, Locale locale) This method is called when the report generation is invoked by maven-site-plugin.protected String
Gets the input files encoding.protected Locale
Gets the localeprotected String
protected String
Gets the effective reporting output files encoding.protected org.apache.maven.project.MavenProject
org.apache.maven.doxia.sink.Sink
getSink()
org.apache.maven.doxia.sink.SinkFactory
protected org.apache.maven.doxia.siterenderer.Renderer
protected File
getXrefLocation
(File location, boolean test) Returns the (Test) Source XRef location as passthrough if provided, otherwise returns the default value.boolean
private void
private void
void
setReportOutputDirectory
(File reportOutputDirectory) Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.maven.reporting.MavenReport
getDescription, getName, getOutputName, getOutputPath
-
Field Details
-
outputDirectory
@Parameter(defaultValue="${project.build.directory}/reports", required=true) protected File outputDirectoryThe shared 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 shared output directory configured in the Maven Site Plugin is used instead.A plugin may use any subdirectory structure (either using a hard-coded name or, ideally, an additional user-defined mojo parameter with a default value) to generate multi-page reports or external reports with the main output file (entry point) denoted by
MavenReport.getOutputName()
. -
project
@Parameter(defaultValue="${project}", readonly=true, required=true) protected org.apache.maven.project.MavenProject projectThe Maven Project. -
mojoExecution
@Parameter(defaultValue="${mojoExecution}", readonly=true, required=true) protected org.apache.maven.plugin.MojoExecution mojoExecutionThe mojo execution -
reactorProjects
@Parameter(defaultValue="${reactorProjects}", required=true, readonly=true) protected List<org.apache.maven.project.MavenProject> reactorProjectsThe reactor projects. -
inputEncoding
@Parameter(property="encoding", defaultValue="${project.build.sourceEncoding}", readonly=true) private String inputEncodingSpecifies the input encoding. -
outputEncoding
@Parameter(property="outputEncoding", defaultValue="${project.reporting.outputEncoding}", readonly=true) private String outputEncodingSpecifies the output encoding. -
repoSession
@Parameter(defaultValue="${repositorySystemSession}", readonly=true, required=true) protected org.eclipse.aether.RepositorySystemSession repoSessionThe repository system session. -
remoteProjectRepositories
@Parameter(defaultValue="${project.remoteProjectRepositories}", readonly=true, required=true) protected List<org.eclipse.aether.repository.RemoteRepository> remoteProjectRepositoriesRemote project repositories used for the project. -
siteDirectory
Directory containing thesite.xml
file. -
locale
The locale to use when the report generation is invoked directly as a standalone Mojo.- See Also:
-
outputTimestamp
Timestamp for reproducible output archive entries, either formatted as ISO 8601yyyy-MM-dd'T'HH:mm:ssXXX
or as an int representing seconds since the epoch (like SOURCE_DATE_EPOCH). -
siteTool
@Component protected org.apache.maven.doxia.tools.SiteTool siteToolSiteTool. -
siteRenderer
@Component protected org.apache.maven.doxia.siterenderer.Renderer siteRendererDoxia Site Renderer component. -
sink
private org.apache.maven.doxia.sink.Sink sinkThe current sink to use -
sinkFactory
private org.apache.maven.doxia.sink.SinkFactory sinkFactoryThe sink factory to use -
reportOutputDirectory
The current shared report output directory to use -
outputFormat
The report output format: null by default, to represent a site, but can be configured to a Doxia Sink id. -
container
@Component private org.codehaus.plexus.PlexusContainer container
-
-
Constructor Details
-
AbstractMavenReport
public AbstractMavenReport()
-
-
Method Details
-
execute
public final void execute() throws org.apache.maven.plugin.MojoExecutionExceptionThis method is called when the report generation is invoked directly as a standalone Mojo. This implementation is now markedfinal
as it is not expected to be overridden:maven-reporting-impl
provides all necessary plumbing.- Specified by:
execute
in interfaceorg.apache.maven.plugin.Mojo
- Throws:
org.apache.maven.plugin.MojoExecutionException
- if an error occurs when generating the report- See Also:
-
reportToMarkup
private void reportToMarkup() throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
reportToSite
private void reportToSite() throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
createSiteRenderingContext
private org.apache.maven.doxia.siterenderer.SiteRenderingContext createSiteRenderingContext(Locale locale) throws org.apache.maven.reporting.MavenReportException, IOException, org.apache.maven.doxia.tools.SiteToolException - Throws:
org.apache.maven.reporting.MavenReportException
IOException
org.apache.maven.doxia.tools.SiteToolException
-
generate
@Deprecated public void generate(org.apache.maven.doxia.sink.Sink sink, Locale locale) throws org.apache.maven.reporting.MavenReportException Deprecated.usegenerate(Sink, SinkFactory, Locale)
instead.Generate a report.- Specified by:
generate
in 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, org.apache.maven.doxia.sink.SinkFactory sinkFactory, Locale locale) throws org.apache.maven.reporting.MavenReportException This method is called when the report generation is invoked by maven-site-plugin.- Specified by:
generate
in interfaceorg.apache.maven.reporting.MavenMultiPageReport
- Parameters:
sink
-sinkFactory
-locale
-- Throws:
org.apache.maven.reporting.MavenReportException
-
getCategoryName
- Specified by:
getCategoryName
in interfaceorg.apache.maven.reporting.MavenReport
- Returns:
- CATEGORY_PROJECT_REPORTS
-
getReportOutputDirectory
- Specified by:
getReportOutputDirectory
in interfaceorg.apache.maven.reporting.MavenReport
-
setReportOutputDirectory
- Specified by:
setReportOutputDirectory
in interfaceorg.apache.maven.reporting.MavenReport
-
getOutputDirectory
-
getProject
protected org.apache.maven.project.MavenProject getProject() -
getSiteRenderer
protected org.apache.maven.doxia.siterenderer.Renderer getSiteRenderer() -
getInputEncoding
Gets the input files encoding.- Returns:
- The input files encoding, never
null
.
-
getOutputEncoding
Gets the effective reporting output files encoding.- Returns:
- The effective reporting output file encoding, never
null
.
-
getLocale
Gets the locale- Returns:
- the locale for this standalone report
-
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:
isExternalReport
in interfaceorg.apache.maven.reporting.MavenReport
- Returns:
false
by default.- See Also:
-
canGenerateReport
public boolean canGenerateReport() throws org.apache.maven.reporting.MavenReportException- Specified by:
canGenerateReport
in interfaceorg.apache.maven.reporting.MavenReport
- Throws:
org.apache.maven.reporting.MavenReportException
-
executeReport
protected abstract void executeReport(Locale locale) throws org.apache.maven.reporting.MavenReportException Execute 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
-
getXrefLocation
Returns the (Test) Source XRef location as passthrough if provided, otherwise returns the default value.- Parameters:
location
- the XRef location provided via plugin parameter, if anytest
- whether it is test source- Returns:
- the actual (Test) Source XRef location
-
constructXrefLocation
Contructs the (Test) Source XRef location relative to thegetReportOutputDirectory()
withgetXrefLocation(File, boolean)
.- Parameters:
location
- the XRef location provided via plugin parameter, if anytest
- whether it is test source- Returns:
- the constructed (Test) Source XRef location
-
generate(Sink, SinkFactory, Locale)
instead.