mojohaus / mojohaus/exec-maven-plugin

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

Open
#146 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement good-first-issue
Dominant language
Java
Stars
191
Forks
111
Avg merge
1d 21h
Merged PRs (30d)
4

Description

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!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the exec-maven-plugin java goal and its existing mainClass behavior. Review the proposed optional class and method parameters, along with the WsImport doMain(String[] args) entry point, to determine the invocation requirements. Done means supporting public static String[] entry points while preserving current mainClass behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.