Determine Maven Build Status (SUCCESS / ERROR) from Maven Plugin

I am wondering how to get build status ( ERROR / SUCCESS ) from Maven plugin?

+4
source share
1 answer

You cannot do this easily. Maven plugins do not work, throwing org.apache.maven.plugin.MojoExecutionException or org.apache.maven.plugin.MojoFailureException and you do not have a hook to listen to these exceptions. Of course not with the plugin, because your plugin will not execute after the crash.

It may be possible to use custom versions

org.apache.maven.lifecycle.DefaultLifecycleExecutor or org.apache.maven.DefaultMaven

which you can enter through the plexus and terminate the plugin in try / catch in order to execute your logic later, but this is very heavy stuff.

Read here plexus container access

+4
source

Source: https://habr.com/ru/post/1313765/


All Articles