|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecthudson.maven.MavenReporter
public abstract class MavenReporter
Listens to the build execution of 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 MavenReporter
s 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 FormNested Class Summary |
---|
Nested classes/interfaces inherited from interface hudson.ExtensionPoint |
---|
ExtensionPoint.LegacyInstancesAreScopedToHudson |
Constructor Summary | |
---|---|
MavenReporter()
|
Method Summary | |
---|---|
boolean |
end(MavenBuild build,
Launcher launcher,
BuildListener listener)
Called after the maven execution finished and the result is determined. |
boolean |
enterModule(MavenBuildProxy build,
org.apache.maven.project.MavenProject pom,
BuildListener listener)
Called when the build enters a next MavenProject . |
Action |
getAggregatedProjectAction(MavenModuleSet project)
Works like getProjectAction(MavenModule) but
works at MavenModuleSet level. |
MavenReporterDescriptor |
getDescriptor()
Gets the descriptor for this instance. |
Action |
getProjectAction(MavenModule module)
Deprecated. as of 1.341 Use getProjectActions(MavenModule) instead. |
Collection<? extends Action> |
getProjectActions(MavenModule module)
Equivalent of BuildStep.getProjectActions(AbstractProject)
for MavenReporter . |
boolean |
leaveModule(MavenBuildProxy build,
org.apache.maven.project.MavenProject pom,
BuildListener listener)
Called when the build leaves the current MavenProject . |
boolean |
postBuild(MavenBuildProxy build,
org.apache.maven.project.MavenProject pom,
BuildListener listener)
Called after a build of one maven2 module is completed. |
boolean |
postExecute(MavenBuildProxy build,
org.apache.maven.project.MavenProject pom,
MojoInfo mojo,
BuildListener listener,
Throwable error)
Called after execution of a single mojo. |
boolean |
preBuild(MavenBuildProxy build,
org.apache.maven.project.MavenProject pom,
BuildListener listener)
Called before the actual maven2 execution begins. |
boolean |
preExecute(MavenBuildProxy build,
org.apache.maven.project.MavenProject pom,
MojoInfo mojo,
BuildListener listener)
Called before execution of a single mojo. |
boolean |
reportGenerated(MavenBuildProxy build,
org.apache.maven.project.MavenProject pom,
MavenReportInfo report,
BuildListener listener)
Called after a MavenReport is successfully generated. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MavenReporter()
Method Detail |
---|
public boolean preBuild(MavenBuildProxy build, org.apache.maven.project.MavenProject pom, 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, 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, BuildListener listener) throws InterruptedException, IOException
MavenProject
.
InterruptedException
IOException
enterModule(hudson.maven.MavenBuildProxy, org.apache.maven.project.MavenProject, hudson.model.BuildListener)
public boolean preExecute(MavenBuildProxy build, org.apache.maven.project.MavenProject pom, MojoInfo mojo, 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, 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.
InterruptedException
IOException
public boolean postBuild(MavenBuildProxy build, org.apache.maven.project.MavenProject pom, 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, Launcher launcher, BuildListener listener) throws InterruptedException, IOException
This method fires after postBuild(MavenBuildProxy, MavenProject, BuildListener)
.
Works like BuildStepCompatibilityLayer.perform(Build, Launcher, BuildListener)
.
InterruptedException
IOException
public boolean reportGenerated(MavenBuildProxy build, org.apache.maven.project.MavenProject pom, MavenReportInfo report, 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
MavenReport
s 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 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 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 MavenProjectActionBuilder
public 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()
Describable
Descriptor
is a singleton for every concrete Describable
implementation, so if a.getClass()==b.getClass() then
a.getDescriptor()==b.getDescriptor() must hold.
getDescriptor
in interface Describable<MavenReporter>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |