Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to call any public static method as an alternate to main() #146

Open
fralalonde opened this issue Jan 10, 2020 · 0 comments
Open

Comments

@fralalonde
Copy link

Some tools expose an alternate entrypoint method (not main()) for in-process calls. exec-maven-plugin having the ability to call any public static method taking a single String[] argument would be very nice in these situations, providing considerable additional versatility for very small cost in complexity.

As an example, the wsimport tool from jax-ws (https://github.com/eclipse-ee4j/metro-jax-ws/blob/master/jaxws-ri/tools/wscompile/src/main/java/com/sun/tools/ws/WsImport.java) has its main() forcefully terminating the process, making it unsuitable for in-process maven execution. But the WsImport class also exposes a public static int doMain(String[] args) which is explicitly documents as a being an "Entry point for tool integration". Being able to call this method instead of main() would make it possible to generate java code from wsdl in-process, speeding up builds considerably as repeatedly forking the wsimport process incurs sizeable performance overhead.

If you find this addition as valuable as I do, I could submit a PR that would add class and method optional plugin configuration parameters to the java goal. Specifying any of those parameters would override the current behavior of the mainClassparameter, preserving backward compatibility.

All comments and opinions gladly welcomed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant