public abstract class MavenReporter extends Object implements hudson.model.Describable<MavenReporter>, hudson.ExtensionPoint, Serializable, MavenProjectActionBuilder
MavenBuild,
and normally records some information and exposes thoses
in MavenBuild later.
MavenReporter is first instanciated on the master.
Then during the build, it is serialized and sent over into
the maven process by serialization. Reporters will then receive
event callbacks as mojo execution progresses. Those event callbacks
are the ones that take MavenBuildProxy.
Once the maven build completes normally or abnormally, the reporters
will be sent back to the master by serialization again, then
have its end(MavenBuild, Launcher, BuildListener) method invoked.
This is a good opportunity to perform the post-build action.
This is the MavenBuild equivalent of BuildStep. Instances
of MavenReporters are persisted with MavenModule/MavenModuleSet,
possibly with configuration specific to that job.
The callback methods are invoked in the following order:
SEQUENCE := preBuild MODULE* postBuild end MODULE := enterModule MOJO+ leaveModule MOJO := preExecute postExecute
When an error happens, the call sequence could be terminated at any point and no further callback methods may be invoked.
MavenReporter can contribute
Action to MavenBuild so that the report can be displayed
in the web UI.
Such action can also implement AggregatableAction if it further
wishes to contribute a separate action to MavenModuleSetBuild.
This mechanism is usually used to provide aggregated report for all the
module builds.
MavenReporters,
Serialized Form| Constructor and Description |
|---|
MavenReporter() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
end(MavenBuild build,
hudson.Launcher launcher,
hudson.model.BuildListener listener)
Called after the maven execution finished and the result is determined.
|
boolean |
enterModule(MavenBuildProxy build,
org.apache.maven.project.MavenProject pom,
hudson.model.BuildListener listener)
Called when the build enters a next
MavenProject. |
hudson.model.Action |
getAggregatedProjectAction(MavenModuleSet project)
Works like
getProjectAction(MavenModule) but
works at MavenModuleSet level. |
MavenReporterDescriptor |
getDescriptor() |
hudson.model.Action |
getProjectAction(MavenModule module)
Deprecated.
as of 1.341
Use
getProjectActions(MavenModule) instead. |
Collection<? extends hudson.model.Action> |
getProjectActions(MavenModule module)
Equivalent of
BuildStep.getProjectActions(AbstractProject)
for MavenReporter. |
boolean |
leaveModule(MavenBuildProxy build,
org.apache.maven.project.MavenProject pom,
hudson.model.BuildListener listener)
Called when the build leaves the current
MavenProject. |
boolean |
postBuild(MavenBuildProxy build,
org.apache.maven.project.MavenProject pom,
hudson.model.BuildListener listener)
Called after a build of one maven2 module is completed.
|
boolean |
postExecute(MavenBuildProxy build,
org.apache.maven.project.MavenProject pom,
MojoInfo mojo,
hudson.model.BuildListener listener,
Throwable error)
Called after execution of a single mojo.
|
boolean |
preBuild(MavenBuildProxy build,
org.apache.maven.project.MavenProject pom,
hudson.model.BuildListener listener)
Called before the actual maven2 execution begins.
|
boolean |
preExecute(MavenBuildProxy build,
org.apache.maven.project.MavenProject pom,
MojoInfo mojo,
hudson.model.BuildListener listener)
Called before execution of a single mojo.
|
boolean |
reportGenerated(MavenBuildProxy build,
org.apache.maven.project.MavenProject pom,
MavenReportInfo report,
hudson.model.BuildListener listener)
Called after a
MavenReport is successfully generated. |
public boolean preBuild(MavenBuildProxy build, org.apache.maven.project.MavenProject pom, hudson.model.BuildListener listener) throws InterruptedException, IOException
pom - Represents the POM to be executed.InterruptedException - If the build is interrupted by the user (in an attempt to abort the build.)
Normally the MavenReporter implementations may simply forward the exception
it got from its lower-level functions.IOException - If the implementation wants to abort the processing when an IOException
happens, it can simply propagate the exception to the caller. This will cause
the build to fail, with the default error message.
Implementations are encouraged to catch IOException on its own to
provide a better error message, if it can do so, so that users have better
understanding on why it failed.public boolean enterModule(MavenBuildProxy build, org.apache.maven.project.MavenProject pom, hudson.model.BuildListener listener) throws InterruptedException, IOException
MavenProject.
When the current build is a multi-module reactor build, every time the build moves on to the next module, this method will be invoked.
Note that as of Maven 2.0.4, Maven does not perform any smart optimization on the order of goal executions. Therefore, the same module might be entered more than once during the build.
preBuild(hudson.maven.MavenBuildProxy, org.apache.maven.project.MavenProject, hudson.model.BuildListener)InterruptedException - See preBuild(hudson.maven.MavenBuildProxy, org.apache.maven.project.MavenProject, hudson.model.BuildListener)IOException - See preBuild(hudson.maven.MavenBuildProxy, org.apache.maven.project.MavenProject, hudson.model.BuildListener)public boolean leaveModule(MavenBuildProxy build, org.apache.maven.project.MavenProject pom, hudson.model.BuildListener listener) throws InterruptedException, IOException
MavenProject.public boolean preExecute(MavenBuildProxy build, org.apache.maven.project.MavenProject pom, MojoInfo mojo, hudson.model.BuildListener listener) throws InterruptedException, IOException
When this method is invoked, MojoInfo.mojo is fully injected with its configuration values.
preBuild(hudson.maven.MavenBuildProxy, org.apache.maven.project.MavenProject, hudson.model.BuildListener)InterruptedException - See preBuild(hudson.maven.MavenBuildProxy, org.apache.maven.project.MavenProject, hudson.model.BuildListener)IOException - See preBuild(hudson.maven.MavenBuildProxy, org.apache.maven.project.MavenProject, hudson.model.BuildListener)public boolean postExecute(MavenBuildProxy build, org.apache.maven.project.MavenProject pom, MojoInfo mojo, hudson.model.BuildListener listener, Throwable error) throws InterruptedException, IOException
See preExecute(hudson.maven.MavenBuildProxy, org.apache.maven.project.MavenProject, hudson.maven.MojoInfo, hudson.model.BuildListener) for the contract.
error - If mojo execution failed with MojoFailureException or
MojoExecutionException, this method is still invoked
with those error objects.
If mojo executed successfully, this parameter is null.InterruptedExceptionIOExceptionpublic boolean postBuild(MavenBuildProxy build, org.apache.maven.project.MavenProject pom, hudson.model.BuildListener listener) throws InterruptedException, IOException
Note that at this point the build result is still not determined.
preBuild(hudson.maven.MavenBuildProxy, org.apache.maven.project.MavenProject, hudson.model.BuildListener)InterruptedException - See preBuild(hudson.maven.MavenBuildProxy, org.apache.maven.project.MavenProject, hudson.model.BuildListener)IOException - See preBuild(hudson.maven.MavenBuildProxy, org.apache.maven.project.MavenProject, hudson.model.BuildListener)public boolean end(MavenBuild build, hudson.Launcher launcher, hudson.model.BuildListener listener) throws InterruptedException, IOException
This method fires after postBuild(MavenBuildProxy, MavenProject, BuildListener).
Works like BuildStepCompatibilityLayer.perform(Build, Launcher, BuildListener).
InterruptedExceptionIOExceptionpublic boolean reportGenerated(MavenBuildProxy build, org.apache.maven.project.MavenProject pom, MavenReportInfo report, hudson.model.BuildListener listener) throws InterruptedException, IOException
MavenReport is successfully generated.
MavenReport is an execution unit inside the Maven site plugin mojos,
such as site:generate. These are what's configured through
<reporting> tag inside POM, although there's normally more
MavenReports than what's specified explicitly, due to defaulting
and inheritance and all the other Maven processing.
This provides an opportunity for plugins to auto-perform some action when a certain reporting is generated.
This method is invoked during the execution of site mojos, between its
preExecute(MavenBuildProxy, MavenProject, MojoInfo, BuildListener)
and postExecute(MavenBuildProxy, MavenProject, MojoInfo, BuildListener, Throwable)
preBuild(hudson.maven.MavenBuildProxy, org.apache.maven.project.MavenProject, hudson.model.BuildListener)InterruptedException - See preBuild(hudson.maven.MavenBuildProxy, org.apache.maven.project.MavenProject, hudson.model.BuildListener)IOException - See preBuild(hudson.maven.MavenBuildProxy, org.apache.maven.project.MavenProject, hudson.model.BuildListener)public hudson.model.Action getProjectAction(MavenModule module)
getProjectActions(MavenModule) instead.BuildStep.getProjectAction(AbstractProject)
for MavenReporter.
Registers a transient action to MavenModule when it's rendered.
This is useful if you'd like to display an action at the module level.
Since this contributes a transient action, the returned Action
will not be serialized.
For this method to be invoked, your MavenReporter has to invoke
MavenBuildProxy.registerAsProjectAction(MavenReporter) during the build.
public Collection<? extends hudson.model.Action> getProjectActions(MavenModule module)
BuildStep.getProjectActions(AbstractProject)
for MavenReporter.
Registers a transient action to MavenModule when it's rendered.
This is useful if you'd like to display an action at the module level.
Since this contributes a transient action, the returned Action
will not be serialized.
For this method to be invoked, your MavenReporter has to invoke
MavenBuildProxy.registerAsProjectAction(MavenReporter) during the build.
getProjectActions in interface MavenProjectActionBuilderpublic hudson.model.Action getAggregatedProjectAction(MavenModuleSet project)
getProjectAction(MavenModule) but
works at MavenModuleSet level.
For this method to be invoked, your MavenReporter has to invoke
MavenBuildProxy.registerAsAggregatedProjectAction(MavenReporter) during the build.
public MavenReporterDescriptor getDescriptor()
getDescriptor in interface hudson.model.Describable<MavenReporter>Copyright © 2016–2017. All rights reserved.