I am wondering how would one get the status of a build (ERROR
/SUCCESS
) from a Maven plugin ?
Asked
Active
Viewed 1,145 times
4

Gerold Broser
- 14,080
- 5
- 48
- 107

Rich
- 41
- 2
-
2May I ask you: what is your use case? – Pascal Thivent Jun 24 '10 at 21:45
1 Answers
4
You can't easily do that. Maven plugins fail by throwing a org.apache.maven.plugin.MojoExecutionException
or a org.apache.maven.plugin.MojoFailureException
, and you don't have a hook to listen to these exceptions. Certainly not with a plugin, because your plugin wouldn't be executed after a failure.
There might be the possibility to use custom versions of
org.apache.maven.lifecycle.DefaultLifecycleExecutor
or
org.apache.maven.DefaultMaven
that you can inject via plexus and wrap plugin execution in try / catch to perfom your logic afterwards, but this is very heavy stuff.
Read here about accessing the plexus container

Sean Patrick Floyd
- 292,901
- 67
- 465
- 588