Hello Steinar.

I am usually not involved in Maven Exec development or even use it a
lot, but I happen to be the person who implemented the 'blockSystemExit'
feature as a PR about 1.5 years ago. So, you may call me an interested
party.

A quick test shows that the feature still seems to work as expected up
to JDK 24 [1]. What do you mean by "Maven build abrubtly terminates"?
The build should terminate with an error, if System.exit was called with
a non-zero return code [2] and reported as follows:

System::exit was called with return code 123

But that is just Maven Exec failing the build. The JVM should not
terminate without notice in the middle of the Mojo execution like
without using 'blockSystemExit'.

As your gist does not qualify as a reproducer, because I cannot just
download and execute it without errors out of context, would you please
create a stand-alone reproducer on GitHub and link to it from this
thread? The maintainers and maybe I can then take a closer look.

[1] https://openjdk.org/jeps/486
[2]
https://www.mojohaus.org/exec-maven-plugin/java-mojo.html#blockSystemExit

Best regards
--
Alexander Kriegisch
https://scrum-master.de


Steinar Bang schrieb am 08.05.2025 um 04:22:

> I am trying to make exec:java from exec-maven-plugin convert a Relax-NG
> schema in XML notation (RNG) to a Relax-NG schema in compact notation:
>  
> https://gist.github.com/steinarb/9f5105c68bf0c5978272e5af99b2ab5f#file-pom-xml-L197
> 
> The config successfully does the file conversion, but then the maven
> build abrubtly terminates, and the reason is here in the mainClass:
>  
> https://github.com/relaxng/jing-trang/blob/master/mod/rng-validate/src/main/com/thaiopensource/relaxng/util/Driver.java#L35
> 
> I.e. the maven build termination is caused by the call to System.exit()
> from the Driver.main() method.
> 
> As you can see in the gist I have tried to use the blockSystemExit
> config, but the maven build still terminates:
>  
> https://gist.github.com/steinarb/9f5105c68bf0c5978272e5af99b2ab5f#file-pom-xml-L205
> 
> Is there a way around this that do not involve creating my own Java code
> to run the desired stuff from trang? (calling the Driver.doMain() method
> would be sufficient, I think...?)

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to