Skip to content

Commit 1645540

Browse files
committed
Expand error messages when quarkus cli fail hard on bad settings.xml
* Fixes #29817 * recurse the exception stack when we can't create the artifact resolver, and append together all of the error messages * the useful error message isn't in the `BootstrapMavenException`, it's in the cause for that exception Signed-off-by:Nathan Erwin <[email protected]>
1 parent ede20c5 commit 1645540

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/QuarkusProjectHelper.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,18 @@ public static MavenArtifactResolver artifactResolver() {
237237
.setWorkspaceDiscovery(false)
238238
.build();
239239
} catch (BootstrapMavenException e) {
240-
throw new IllegalStateException("Failed to initialize the Maven artifact resolver", e);
240+
StringBuilder messages = new StringBuilder("Failed to initialize the Maven artifact resolver");
241+
Throwable current = e;
242+
while (null != current) {
243+
if (null != current.getMessage() && !current.getMessage().isBlank()) {
244+
messages
245+
.append("\n")
246+
.append(current.getMessage());
247+
}
248+
249+
current = current.getCause();
250+
}
251+
throw new IllegalStateException(messages.toString().trim(), e);
241252
}
242253
}
243254
return artifactResolver;

0 commit comments

Comments
 (0)