Search code examples
mavenmaven-plugin

How to prevent build failure with custom Maven Plugin?


How do i prevent my custom maven plugin to fail the build?

I do not want to the build to fail if there is an issue in the custom maven plugin. How do i implement that?

Any examples would be helpful.

I see but not sure how to configure that.


Solution

  • Believing https://maven.apache.org/ref/3.6.3/maven-plugin-api/apidocs/org/apache/maven/plugin/Mojo.html#execute(), I would "simply" catch all exceptions. (In mojo.execute())

    Advanced: Introduce a plugin parameter à la failOnError(/+failOnWarning) ...and catch/throw accordingly.