Stop run, if maven target executed after make fails.
I'm writing an application using the quasar framework. This requires a maven goal to be run to instrument the java class files. I was glad to find that there is an "Execute after make" option, in the "Maven Projects" view.
When I click run, the maven goal is executed, but occasionally will legitimately fail. At this point, I expect IntelliJ IDEA to stop, but instead it continues, wiping the error message, and runs the application.
Is there a way to get IntelliJ IDEA 15 to stop if one of the goals fail?
thanks!
Please sign in to leave a comment.
Hi Andrew,
It should work exactly this way - do not run App if "After make" goal execution fails. You can check it using standard maven test goal, just add a failing test to the module.
Which maven goal do you use? Is it something from custom written plugin goal? Does it terninate process with the correct exit code in case of fail?
If I run:
$ mvn
...
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.3:run (instrument-classes) on project undertows: An Ant BuildException has occured: Unable to instrument net/bramp/threads/sleep/QuasarSleepHandler$SleepFiber#run()Ljava/lang/Void; because of blocking call to java/lang/Thread#sleep(J)V -> [Help 1]
...
$ echo $?
1
Ah but you may be onto something, if I run:
$ mvn antrun:run
$ echo $?
I always get zero. This is the target I'm telling IntelliJ to run after make. I will continue to investigate, why running the target directly seems to not produce the error.
Ok, resolved my issue now. This was a maven configuration mistake. When the target was ran specifically from the command line, it did not actually do its job, thus didn't return an error.
For future reference, I had maven config that looked like:
But due to the non defaut ID listed, that config wouldn't be used when running directly from the CLI. Now I've transformed my maven to drop the executions section: