Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow falling back to the bundled platform in case quarkus-platform-descriptor-json:jar couldn't be resolved #5517

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,12 @@ public QuarkusPlatformDescriptor resolve() {
return loadFromFile(jsonDescriptor);
}
return resolveJsonDescriptor(artifactResolver);
} catch (PlatformDescriptorLoadingException e) {
} catch (VersionNotAvailableException | PlatformDescriptorLoadingException e) {
throw new IllegalStateException("Failed to load Quarkus platform descriptor", e);
}
}

private QuarkusPlatformDescriptor loadFromFile(Path jsonFile) throws PlatformDescriptorLoadingException {
private QuarkusPlatformDescriptor loadFromFile(Path jsonFile) throws PlatformDescriptorLoadingException, VersionNotAvailableException {
log.debug("Loading Quarkus platform descriptor from %s", jsonFile);
if(!Files.exists(jsonFile)) {
throw new IllegalArgumentException("Failed to locate extensions JSON file at " + jsonFile);
Expand All @@ -176,6 +176,8 @@ private QuarkusPlatformDescriptor loadFromFile(Path jsonFile) throws PlatformDes

try (InputStream is = Files.newInputStream(jsonFile)) {
return loadPlatformDescriptor(artifactResolver, is, quarkusCoreVersion);
} catch (VersionNotAvailableException e) {
throw e;
} catch (Exception e) {
throw new PlatformDescriptorLoadingException("Failed to load Quarkus platform descriptor from " + jsonFile, e);
}
Expand Down Expand Up @@ -295,7 +297,7 @@ private QuarkusPlatformDescriptor resolveJsonArtifactFromBom(AppModelResolver ar
bomGroupId = this.bomGroupId;
if(bomGroupId != null) {
if(!bomGroupId.equals(getGroupId(bundledBom))) {
throw new IllegalStateException("Failed to resolve Quarkus platform BOM with the requested groupId " + bomGroupId);
throw new IllegalStateException("Failed to resolve Quarkus platform using the requested BOM groupId " + bomGroupId);
}
} else {
bomGroupId = getGroupId(bundledBom);
Expand All @@ -307,7 +309,7 @@ private QuarkusPlatformDescriptor resolveJsonArtifactFromBom(AppModelResolver ar
bomArtifactId = this.bomArtifactId;
if(bomArtifactId != null) {
if(!bomArtifactId.equals(getArtifactId(bundledBom))) {
throw new IllegalStateException("Failed to resolve Quarkus platform BOM with the requested artifactId " + bomArtifactId);
throw new IllegalStateException("Failed to resolve Quarkus platform using the requested BOM artifactId " + bomArtifactId);
}
} else {
bomArtifactId = getArtifactId(bundledBom);
Expand All @@ -319,7 +321,7 @@ private QuarkusPlatformDescriptor resolveJsonArtifactFromBom(AppModelResolver ar
bomVersion = this.bomVersion;
if(bomVersion != null) {
if(!bomVersion.equals(getVersion(bundledBom))) {
throw new IllegalStateException("Failed to resolve Quarkus platform BOM with the requested version " + bomVersion);
throw new IllegalStateException("Failed to resolve Quarkus platform using the requested BOM version " + bomVersion);
}
} else if(this.bomVersionRange == null) {
bomVersion = getVersion(bundledBom);
Expand Down Expand Up @@ -418,7 +420,7 @@ private QuarkusPlatformDescriptor loadFromJsonArtifact(AppModelResolver artifact

@SuppressWarnings("rawtypes")
private QuarkusPlatformDescriptor loadPlatformDescriptor(AppModelResolver mvn, final InputStream jsonStream,
String quarkusCoreVersion) throws PlatformDescriptorLoadingException {
String quarkusCoreVersion) throws PlatformDescriptorLoadingException, VersionNotAvailableException {

ClassLoader jsonDescrLoaderCl = null;

Expand Down Expand Up @@ -453,6 +455,8 @@ private QuarkusPlatformDescriptor loadPlatformDescriptor(AppModelResolver mvn, f
resourceLoader = Files.isDirectory(path) ? new DirectoryResourceLoader(path) : new ZipResourceLoader(path);
log.debug("Quarkus platform resources will be loaded from %s", path);
jsonDescrUrl = path.toUri().toURL();
} catch (AppModelResolverException e) {
throw new VersionNotAvailableException("Failed to resolve " + jsonDescrArtifact, e);
} catch (Exception e) {
throw new PlatformDescriptorLoadingException("Failed to resolve " + jsonDescrArtifact, e);
}
Expand Down