From acc1f796e4cf0a302514aa3f49979b09936bf3c4 Mon Sep 17 00:00:00 2001 From: Parul Sharma Date: Thu, 25 Jul 2024 11:33:17 +0530 Subject: [PATCH] Print more helpful message if no artifact matching the version pattern is found --- .../prospero/cli/ExecutionExceptionHandler.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/prospero-cli/src/main/java/org/wildfly/prospero/cli/ExecutionExceptionHandler.java b/prospero-cli/src/main/java/org/wildfly/prospero/cli/ExecutionExceptionHandler.java index 282b081de..5da15c79c 100644 --- a/prospero-cli/src/main/java/org/wildfly/prospero/cli/ExecutionExceptionHandler.java +++ b/prospero-cli/src/main/java/org/wildfly/prospero/cli/ExecutionExceptionHandler.java @@ -176,10 +176,22 @@ private void printResolutionException(ArtifactResolutionException ex) { } printRepositories(ex.getRepositories(), ex.isOffline()); + if (versionPatternMismatch(ex.getMissingArtifacts())) { + console.error("It seems the version pattern does not match the expected format. Ensure that your version pattern is correct."); + } } else { console.error(CliMessages.MESSAGES.errorHeader(ex.getLocalizedMessage())); } } + private boolean versionPatternMismatch(Set missingArtifacts) { + for (ArtifactCoordinate artifact : missingArtifacts) { + // Adjust this pattern to match your specific needs + if (!artifact.getVersion().matches(".*\\.redhat-.*")) { + return true; + } + } + return false; + } private void printRepositories(Set repositories, boolean b) { if (!repositories.isEmpty()) {