On 25/01/2024 12:34, Tomas Langer wrote:
Is there a way to define a main class on a module if it comes from a
different one?
Currently we need to start the JVM as follows:
*java –module-path ... --add-modules my.modular.application --module
io.helidon.microprofile.cdi/io.helidon.microprofile.cdi.Main*
What we do:
* our microprofile implementation bootstraps a framework, that
discovers its component using service loader, it also contains the
Main class needed to start
* the "my.modular.application" provides such components (such as an
HTTP endpoint), but does not need a main class
Ideally, I would like to run "my.modular.application" to have a
simpler command line.
I cannot do that, as the main class is from a different module (and I
think that cannot be added to the module metadata).
So I have to run the main class from the CDI module, and use
`--add-modules`, as otherwise my application module would not end up
on the module path (as it is not the "main" module started).
Is there some way please to simplify this? Or do we need to create a
Main class for each application, even if it would just delegate to the
"cdi.Main"?
Is the application module discovered with service loader too? In that
case, the --add-modules shouldn't be needed, instead just make it
observable on the module path and service binding will ensure that it
resolved.
-Alan