From 55ea99116c1aa87cc7cc3d5fb1fc5fca22e62de9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Hohwiller?= Date: Mon, 30 Sep 2024 22:14:31 +0200 Subject: [PATCH] #652: properly report step success/error (#666) --- .../main/java/com/devonfw/tools/ide/tool/eclipse/Eclipse.java | 3 ++- cli/src/main/java/com/devonfw/tools/ide/tool/mvn/Mvn.java | 3 ++- .../tools/ide/tool/plugin/ExamplePluginBasedCommandlet.java | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/cli/src/main/java/com/devonfw/tools/ide/tool/eclipse/Eclipse.java b/cli/src/main/java/com/devonfw/tools/ide/tool/eclipse/Eclipse.java index 307c9801a..ce79eded0 100644 --- a/cli/src/main/java/com/devonfw/tools/ide/tool/eclipse/Eclipse.java +++ b/cli/src/main/java/com/devonfw/tools/ide/tool/eclipse/Eclipse.java @@ -79,13 +79,14 @@ public void installPlugin(ToolPluginDescriptor plugin, Step step) { if (result.isSuccessful()) { for (String line : result.getOut()) { if (line.contains("Overall install request is satisfiable")) { + step.success(); return; } } } - this.context.error("Failed to install plugin {} ({}): exit code was {}", plugin.name(), plugin.id(), result.getExitCode()); log(IdeLogLevel.DEBUG, result.getOut()); log(IdeLogLevel.ERROR, result.getErr()); + step.error("Failed to install plugin {} ({}): exit code was {}", plugin.name(), plugin.id(), result.getExitCode()); } private void log(IdeLogLevel level, List lines) { diff --git a/cli/src/main/java/com/devonfw/tools/ide/tool/mvn/Mvn.java b/cli/src/main/java/com/devonfw/tools/ide/tool/mvn/Mvn.java index 5505fbdce..c86b68818 100644 --- a/cli/src/main/java/com/devonfw/tools/ide/tool/mvn/Mvn.java +++ b/cli/src/main/java/com/devonfw/tools/ide/tool/mvn/Mvn.java @@ -190,8 +190,9 @@ public void installPlugin(ToolPluginDescriptor plugin, Step step) { if (Files.exists(mavenPlugin)) { this.context.success("Successfully added {} to {}", plugin.name(), mavenPlugin.toString()); + step.success(); } else { - this.context.warning("Plugin {} has wrong properties\n" // + step.error("Plugin {} has wrong properties\n" // + "Please check the plugin properties file in {}", mavenPlugin.getFileName(), mavenPlugin.toAbsolutePath()); } } diff --git a/cli/src/test/java/com/devonfw/tools/ide/tool/plugin/ExamplePluginBasedCommandlet.java b/cli/src/test/java/com/devonfw/tools/ide/tool/plugin/ExamplePluginBasedCommandlet.java index 92b0b9120..fef800949 100644 --- a/cli/src/test/java/com/devonfw/tools/ide/tool/plugin/ExamplePluginBasedCommandlet.java +++ b/cli/src/test/java/com/devonfw/tools/ide/tool/plugin/ExamplePluginBasedCommandlet.java @@ -26,5 +26,6 @@ public ExamplePluginBasedCommandlet(IdeContext context, String tool, Set ta @Override public void installPlugin(ToolPluginDescriptor plugin, Step step) { + step.success(); } }