0xff
0xff

Reputation: 189

Picocli - "Missing required Parameters" even when passed parameters

@Parameters(paramLabel = "AMOUNT", description = "the depth to scrape for")
private int amount;

@Parameters(paramLabel = "ENTRY_POINT", description = "the entry point for the scrape")
private String entryPoint;

I have these Parameters in my Main class. When I run the program with ClassName 5 https://www.baeldung.com/ I get

Missing required parameters: 'AMOUNT', 'ENTRY_POINT'
Usage: <main class> AMOUNT ENTRY_POINT
      AMOUNT        the depth to scrape for
      ENTRY_POINT   the entry point for the scrape

Does anyone know why this happens?

I can provide more code if needed.

Upvotes: -1

Views: 671

Answers (1)

0xff
0xff

Reputation: 189

Resolved; I didn't pass the arguments from the command-line in my main-mathod ...

Pretty stupid lol.

Before, not working

public static void main(String[] args) {
    var cmd = new CommandLine(new Scraper());
    cmd.execute();
}

After, working

public static void main(String[] args) {
    var cmd = new CommandLine(new Scraper());
    cmd.execute(args);
}

Upvotes: 1

Related Questions