Class ReportScriptingMojo
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled
,org.apache.maven.plugin.Mojo
,org.apache.maven.reporting.MavenMultiPageReport
,org.apache.maven.reporting.MavenReport
MavenReport
during the
LifecyclePhase.SITE
.
This plugin goal intends to allow the use of scripting in the SITE
lifecycle phase with the help of ReportScript
. The motivation behind
this is the inability to use Maven AntRun in the SITE
phase.
-
Field Summary
FieldsModifier and TypeFieldDescriptionorg.codehaus.plexus.configuration.PlexusConfiguration
The script to be used to produce the report, in the scripting language identified by itsmimetype
orengine
attribute.Fields inherited from class org.apache.maven.reporting.AbstractMavenReport
outputDirectory, project, siteRenderer
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
Queries the script as to whether this report can be generated.(package private) boolean
Default implementation ofReportScript.canGenerateReport(ReportScriptingMojo)
.org.apache.maven.reporting.MavenReportException
exceptionWrap
(Object object) Wraps the input object in aMavenReportException
.protected void
executeReport
(Locale locale) Queries the script for the category name of this report, used byMaven
to place the report under the correct heading inindex.html
.(package private) String
Default implementation ofReportScript.getCategoryName(ReportScriptingMojo)
.getDescription
(Locale locale) Queries the script for the description of this report, to be used byMaven
for display inindex.html
.Queries the script for the name of this report to be used byMaven
for display inindex.html
.Queries the script for the report output path relative to the target site directory.org.apache.maven.project.MavenProject
boolean
Queries the script to return false if this report will produce output through a suppliedSink
, or true if it is 'external', producing its output some other way.(package private) boolean
Default implementation forReportScript.isExternalReport(ReportScriptingMojo)
.Methods inherited from class org.apache.maven.reporting.AbstractMavenReport
closeReport, execute, generate, generate, generate, getOutputDirectory, getReportOutputDirectory, getSink, getSinkFactory, getSiteRenderer, setReportOutputDirectory
Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Field Details
-
script
@Parameter public org.codehaus.plexus.configuration.PlexusConfiguration scriptThe script to be used to produce the report, in the scripting language identified by itsmimetype
orengine
attribute.The scripting language must be supported by an engine that implements
Invocable
, and the script, when evaluated, must define functions that correspond to all of the abstract methods ofReportScript
, and any of the default methods that it wishes to override.
-
-
Constructor Details
-
ReportScriptingMojo
public ReportScriptingMojo()
-
-
Method Details
-
getOutputName
Queries the script for the report output path relative to the target site directory.This value will be used by
Maven
to provide a link to the report fromindex.html
.Calls
setReportScript
to ensure that the instance ofReportScript
is available. InvokesgetOutputName(report)
defined by the script snippet associated with the report. No default implementation is provided; the script must implement this method. -
isExternalReport
public boolean isExternalReport()Queries the script to return false if this report will produce output through a suppliedSink
, or true if it is 'external', producing its output some other way.Calls
setReportScript
to ensure that the instance ofReportScript
is available. InvokesisExternalReport(report)
if defined in the script snippet associated with the report. Otherwise, the implementation inherited by this class is effectively invoked.- Specified by:
isExternalReport
in interfaceorg.apache.maven.reporting.MavenReport
- Overrides:
isExternalReport
in classorg.apache.maven.reporting.AbstractMavenReport
-
getName
Queries the script for the name of this report to be used byMaven
for display inindex.html
.Calls
setReportScript
to ensure that the instance ofReportScript
is available. InvokesgetName(report, locale)
defined by the script snippet associated with the report. No default implementation is provided; the script must implement this method. -
getDescription
Queries the script for the description of this report, to be used byMaven
for display inindex.html
.Calls
setReportScript
to ensure that the instance ofReportScript
is available. InvokesgetDescription(report, locale)
defined in the script snippet associated with the report. No default implementation is provided; the script must implement this method. -
getCategoryName
Queries the script for the category name of this report, used byMaven
to place the report under the correct heading inindex.html
.Calls
setReportScript
to ensure that the instance ofReportScript
is available. InvokesgetCategoryName(report)
if defined by the script snippet associated with the report. Otherwise, the implementation inherited by this class is effectively invoked.- Specified by:
getCategoryName
in interfaceorg.apache.maven.reporting.MavenReport
- Overrides:
getCategoryName
in classorg.apache.maven.reporting.AbstractMavenReport
-
canGenerateReport
public boolean canGenerateReport()Queries the script as to whether this report can be generated.Calls
setReportScript
to ensure that the instance ofReportScript
is available. InvokescanGenerateReport(report)
if defined by the script snippet. Otherwise, the implementation inherited by this class is effectively invoked.- Specified by:
canGenerateReport
in interfaceorg.apache.maven.reporting.MavenReport
- Overrides:
canGenerateReport
in classorg.apache.maven.reporting.AbstractMavenReport
-
executeReport
Calls
setReportScript
to ensure that the instance ofReportScript
is available. Invokes itsexecuteReport(report, locale)
, passing this instance and the supplied locale.- Specified by:
executeReport
in classorg.apache.maven.reporting.AbstractMavenReport
- Throws:
org.apache.maven.reporting.MavenReportException
-
getProject
public org.apache.maven.project.MavenProject getProject()- Overrides:
getProject
in classorg.apache.maven.reporting.AbstractMavenReport
-
getInputEncoding
- Overrides:
getInputEncoding
in classorg.apache.maven.reporting.AbstractMavenReport
-
getOutputEncoding
- Overrides:
getOutputEncoding
in classorg.apache.maven.reporting.AbstractMavenReport
-
isExternalReportDefault
boolean isExternalReportDefault()Default implementation forReportScript.isExternalReport(ReportScriptingMojo)
. Invoked ifisExternalReport(report)
is not defined in the script snippet associated with the report. -
getCategoryNameDefault
String getCategoryNameDefault()Default implementation ofReportScript.getCategoryName(ReportScriptingMojo)
. Invoked ifgetCategoryName(report)
is not defined in the script snippet associated with the report. -
canGenerateReportDefault
boolean canGenerateReportDefault()Default implementation ofReportScript.canGenerateReport(ReportScriptingMojo)
. Invoked ifcanGenerateReport(report)
is not defined in the script snippet associated with the report. -
exceptionWrap
Wraps the input object in aMavenReportException
. The exception returned is constructed as follows:- If
object
is null, the exception message indicates the same. - If
object
is already aMavenReportException
, it is returned as is. - If
object
is any otherThrowable
, it is used as the wrapping exception's cause. - If
object
is aString
, it is used as the wrapping exception's message. - If it is any other object, the wrapping exception's message is set in this format: Class mame of object: String representation of object.
- Parameters:
object
- to wrap in MavenReportException- Returns:
- object wrapped inside a
MavenReportException
- If
-