mojohaus / exec-maven-plugin

Exec Maven Plugin
https://www.mojohaus.org/exec-maven-plugin/
Apache License 2.0
163 stars 96 forks source link

New option 'blockSystemExit' for 'java' mojo #389

Closed kriegaex closed 7 months ago

kriegaex commented 7 months ago

Relates to #388, specifically to https://github.com/mojohaus/exec-maven-plugin/issues/388#issuecomment-1801195082.

If the code called by exec:java misbehaves and executes System.exit(int) instead of simply returning when successful or throwing an exception in case of an error, it not only interrupts the execution of this mojo, but terminates the whole Maven JVM in the middle of a build. In order to not force users to switch to the forking exec:exec goal instead and enable them to stay within the comfort zone of exec:java, I am proposing a special security manager which blocks System.exit(int) execution in favour of

@slawekjaranowski: As discussed, a corresponding PR for this issue is in the pipeline. I already have an implementation, I just need to write a couple of integration tests on top of it.