9

Is it possible to provide a custom main(String[] args) method for a Quarkus application? Or is there any other way to access the command line arguments?

The use case would be to build a native image to be used as a command line tool.

Harald Wellmann
  • 12,615
  • 4
  • 41
  • 63

2 Answers2

13

This is now officially supported :) https://quarkus.io/guides/lifecycle

import io.quarkus.runtime.annotations.QuarkusMain;
import io.quarkus.runtime.Quarkus;

@QuarkusMain  
public class Main {

    public static void main(String ... args) {
        System.out.println("Running main method");
        Quarkus.run(args); 
    }
}
maxday
  • 1,322
  • 1
  • 16
  • 32
8

Currently Quarkus doesn't support this use case, however it is definitely on the roadmap, see: https://github.com/quarkusio/quarkus/issues/284

Update

see https://stackoverflow.com/a/61665893/2504224 for the supported way of doing this

geoand
  • 60,071
  • 24
  • 172
  • 190