> Currently the Security Manager is not used. Classes are transformed by
> ASM

Oh, that is interesting. I had no idea that this was changed internally
already. Nifty trick to use an ASM transformer. After your hint, I just
found

  -- BlockExitTransformer,
  -- BlockExitTransformer.SystemExitOverrideVisitor

in the source code. I see that my old class SystemExitManager is now
just an empty shell with a new static method 'exit' to which
SystemExitOverrideVisitor delegates the 'System.exit' call. Cute!

When first reopening the project locally and updating the main branch, I
still found this TODO [1] ExecJavaMojo#execute and thought, the issue
had not been addressed yet. Maybe, you want to remove the TODO.

[1]
https://github.com/mojohaus/exec-maven-plugin/blob/47eac15af14e836d54aeb8fae4c047182f224a1f/src/main/java/org/codehaus/mojo/exec/ExecJavaMojo.java#L267-L270
--
Alexander Kriegisch
https://scrum-master.de

Slawomir Jaranowski schrieb am 08.05.2025 um 12:47:
> On Thu, 8 May 2025 at 05:19, Alexander Kriegisch
> <alexan...@kriegisch.name> wrote:
>>
>> 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"?
> 
> Currently the Security Manager is not used. Classes are transformed by ASM,
> so the next release with updated ASM will help with newer JDK.
> 
>> 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
>>
> 
> 


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

Reply via email to