From 8f2cf4bab4becef95dc931b2e2c58a6a45fc92f3 Mon Sep 17 00:00:00 2001 From: Tamas Cservenak Date: Wed, 23 Oct 2024 09:57:26 +0200 Subject: [PATCH 1/2] Fix NPE in tree command The command mandatory param was lacking def value and full set of annotations for picocli --- .../eu/maveniverse/maven/toolbox/plugin/gav/GavTreeMojo.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/toolbox/src/main/java/eu/maveniverse/maven/toolbox/plugin/gav/GavTreeMojo.java b/toolbox/src/main/java/eu/maveniverse/maven/toolbox/plugin/gav/GavTreeMojo.java index 895d9e4..aec1a79 100644 --- a/toolbox/src/main/java/eu/maveniverse/maven/toolbox/plugin/gav/GavTreeMojo.java +++ b/toolbox/src/main/java/eu/maveniverse/maven/toolbox/plugin/gav/GavTreeMojo.java @@ -52,6 +52,10 @@ public class GavTreeMojo extends GavMojoSupport { /** * The dependency matcher if you want to filter as eager as Lenny wants. */ + @CommandLine.Option( + names = {"--dependencyMatcher"}, + defaultValue = "any()", + description = "Dependency matcher spec") @Parameter(property = "dependencyMatcher", defaultValue = "any()", required = true) private String dependencyMatcher; From 34af4e4504882f1d0b0c6e1579bca480f766c342 Mon Sep 17 00:00:00 2001 From: Tamas Cservenak Date: Wed, 23 Oct 2024 09:59:15 +0200 Subject: [PATCH 2/2] Make error situation clear --- .../eu/maveniverse/maven/toolbox/plugin/MojoSupport.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/toolbox/src/main/java/eu/maveniverse/maven/toolbox/plugin/MojoSupport.java b/toolbox/src/main/java/eu/maveniverse/maven/toolbox/plugin/MojoSupport.java index 1487c8e..3698933 100644 --- a/toolbox/src/main/java/eu/maveniverse/maven/toolbox/plugin/MojoSupport.java +++ b/toolbox/src/main/java/eu/maveniverse/maven/toolbox/plugin/MojoSupport.java @@ -226,8 +226,12 @@ public final Integer call() { } else { return 0; } + } catch (RuntimeException e) { + System.err.println("Error: " + e.getClass() + ": " + e.getMessage()); + e.printStackTrace(System.err); + return 1; } catch (Exception e) { - System.err.println(e.getMessage()); + System.err.println("Error: " + e.getClass() + ": " + e.getMessage()); if (errors) { e.printStackTrace(System.err); }