fabric8io / vertx-maven-plugin

Vert.x Maven Plugin - moved to https://github.com/reactiverse/vertx-maven-plugin
https://github.com/reactiverse/vertx-maven-plugin
Apache License 2.0
25 stars 5 forks source link

Using custom launcher fails to package properly #142

Closed InfoSec812 closed 6 years ago

InfoSec812 commented 6 years ago

When using a custom launcher via the vertx.launcher property, if you use vertx:package and try to run the resulting fat-jar it will fail with:

Usage: java -jar target/<package>-<version>.jar [COMMAND] [OPTIONS] [arg...]

Commands:
    bare      Creates a bare instance of vert.x.
    list      List vert.x applications
    run       Runs a verticle called <main-verticle> in its own instance of
              vert.x.
    start     Start a vert.x application in background
    stop      Stop a vert.x application
    version   Displays the version.

Run 'java -jar target/<package>-<version>.jar COMMAND --help' for more
information on a command.

Expected results: Running the fat-jar will default to the run command

Version: 1.0.13

InfoSec812 commented 6 years ago

I tried to work around this by overriding the getDefaultCommand or getCommandFromManifest. Neither of these options worked. In the end, I DID find a workaround.. I overrode the main method as follows:

    public static void main(String[] args) {
        new MetricsLauncher().dispatch(new String[]{"run", MAIN_VERTICLE});
    }
cescoffier commented 6 years ago

Hi,

Is your class extending Launcher? In that case, yes, the code you write is required (but this should be documented). If your class does not extend Launcher but just have a main method, then no...

2018-04-15 18:32 GMT+02:00 Deven Phillips notifications@github.com:

I tried to work around this by overriding the getDefaultCommand or getCommandFromManifest. Neither of these options worked. In the end, I DID find a workaround.. I overrode the main method as follows:

public static void main(String[] args) {
    new MetricsLauncher().dispatch(new String[]{"run", MAIN_VERTICLE});
}

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/fabric8io/vertx-maven-plugin/issues/142#issuecomment-381419496, or mute the thread https://github.com/notifications/unsubscribe-auth/AAYjfS7hvOLTVWVhZMIhUPODw2XO5NnJks5to3YegaJpZM4TVibY .

InfoSec812 commented 6 years ago

Yes, I am extending Launcher so that I can configure Hawkular metrics via Kubernetes configmaps

cescoffier commented 6 years ago

Fixed in https://github.com/reactiverse/vertx-maven-plugin/issues/15.