0

I've made a Maven plugin. The problem is even throwing MojoExecutionException (or MojoFailureException) will not stop build procedure! Is any other configuration required?

@Mojo( name = "something") public class CoffeescriptMojo extends AbstractMojo { public void execute() throws MojoExecutionException, MojoFailureException { new MojoExecutionException("Error not raise!"); } } 

Usage:

<groupId>my.sample</groupId> <artifactId>sample</artifactId> <version>1.1-SNAPSHOT</version> <executions> <execution> <phase>compile</phase> <goals> <goal>something</goal> </goals> </execution> </executions> 
4
  • How have you called Maven? with --fail-at-end? Commented Jul 22, 2015 at 5:23
  • I'm running mvn clean install and getting Build successful Commented Jul 22, 2015 at 7:53
  • Do you have the code somewhere? GitHub ? Commented Jul 22, 2015 at 11:18
  • github.com/wpic/coffeescript-maven-plugin Commented Jul 23, 2015 at 10:20

1 Answer 1

1

Very stupid mistake. I forgot to add throw at the beginning. Thanks to new Intellij for code warnings I found it!

new MojoExecutionException("Error not raise!"); 

has to be:

throw new MojoExecutionException("Error not raise!"); 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.