I am calling Cucumber JVM as part of a maven life cycle using the exec plugin. However, Cucumber seems to use System.exit() when it terminates so it prematurely stops my maven run. This forces me to fork it to a separate process but that presents issues when I am trying to debug a test.
Is there a way to politely ask Cucumber JVM to not use System.exit() when it terminates?
(I'm assuming there is a good reason not to use the junit runner & that you're calling cucumber.api.cli.Main
, if either assumption is false pls clarify the question)
The simplest/most expedient solution, given that cucumber.api.cli.Main
is approx 4 lines of code, is to write your own main method that is a clone of the cucumber one without the System.exit
call.
Separately you could raise the issue on their github site and/or send them a pull request with the required tweak to their Main
class (e.g. don't do the system.exit if some system property has been set).