mirror of
https://github.com/jlengrand/quarkus.git
synced 2026-03-10 08:41:22 +00:00
Merge pull request #5517 from aloubyansky/platform-resolver-descriptor-jar-allows-fallback
Allow falling back to the bundled platform in case quarkus-platform-descriptor-json:jar couldn't be resolved
This commit is contained in:
@@ -150,12 +150,12 @@ public class QuarkusJsonPlatformDescriptorResolver {
|
||||
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);
|
||||
@@ -176,6 +176,8 @@ public class QuarkusJsonPlatformDescriptorResolver {
|
||||
|
||||
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);
|
||||
}
|
||||
@@ -295,7 +297,7 @@ public class QuarkusJsonPlatformDescriptorResolver {
|
||||
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);
|
||||
@@ -307,7 +309,7 @@ public class QuarkusJsonPlatformDescriptorResolver {
|
||||
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);
|
||||
@@ -319,7 +321,7 @@ public class QuarkusJsonPlatformDescriptorResolver {
|
||||
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);
|
||||
@@ -418,7 +420,7 @@ public class QuarkusJsonPlatformDescriptorResolver {
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
private QuarkusPlatformDescriptor loadPlatformDescriptor(AppModelResolver mvn, final InputStream jsonStream,
|
||||
String quarkusCoreVersion) throws PlatformDescriptorLoadingException {
|
||||
String quarkusCoreVersion) throws PlatformDescriptorLoadingException, VersionNotAvailableException {
|
||||
|
||||
ClassLoader jsonDescrLoaderCl = null;
|
||||
|
||||
@@ -453,6 +455,8 @@ public class QuarkusJsonPlatformDescriptorResolver {
|
||||
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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user