Oleg
Oleg

Reputation: 179

make a plugin abort the build process with maven

I have written a maven plugin which under certain conditions throws a

MojoExecutionException

I would like my plugin to abort the build process if such an exception is thrown. Is there a way to do so ?

Upvotes: 1

Views: 365

Answers (1)

user180100
user180100

Reputation:

From the doc:

The execute method can throw two exceptions:

  • org.apache.maven.plugin.MojoExecutionException if an unexpected problem occurs. Throwing this exception causes a "BUILD ERROR" message to be displayed.
  • org.apache.maven.plugin.MojoFailureException if an expected problem (such as a compilation failure) occurs. Throwing this exception causes a "BUILD FAILURE" message to be displayed.

So you will have to change the thrown exception

Upvotes: 3

Related Questions