Skip to content

Commit

Permalink
Merge pull request #16049 from aloubyansky/resolve-quarkus-core-versi…
Browse files Browse the repository at this point in the history
…on-from-runtime-deps

Resolve Quarkus version from the runtime dependencies instead of the deployment ones
  • Loading branch information
gsmet authored Mar 29, 2021
2 parents 98032ab + c5a669f commit 3c079a6
Showing 1 changed file with 18 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,15 @@ private static JsonNode getJsonElement(ObjectNode extObject, String... elements)

private void setBuiltWithQuarkusCoreVersion(ObjectMapper mapper, ObjectNode extObject) throws MojoExecutionException {
final QuarkusCoreDeploymentVersionLocator coreVersionLocator = new QuarkusCoreDeploymentVersionLocator();
collectDeploymentDeps().getRoot().accept(coreVersionLocator);
final DependencyNode root;
try {
root = repoSystem.collectDependencies(repoSession, newCollectRuntimeDepsRequest()).getRoot();
} catch (MojoExecutionException e) {
throw e;
} catch (Exception e) {
throw new MojoExecutionException("Failed to collect runtime dependencies of " + project.getArtifact(), e);
}
root.accept(coreVersionLocator);
if (coreVersionLocator.coreVersion != null) {
ObjectNode metadata;
JsonNode mvalue = extObject.get(METADATA);
Expand Down Expand Up @@ -453,12 +461,7 @@ private void validateExtensionDeps() throws MojoExecutionException {

try {
resolvedDeps = repoSystem.resolveDependencies(repoSession,
new DependencyRequest()
.setCollectRequest(newCollectRequest(new DefaultArtifact(project.getArtifact().getGroupId(),
project.getArtifact().getArtifactId(),
project.getArtifact().getClassifier(),
project.getArtifact().getArtifactHandler().getExtension(),
project.getArtifact().getVersion()))));
new DependencyRequest().setCollectRequest(newCollectRuntimeDepsRequest()));
} catch (Exception e) {
throw new MojoExecutionException("Failed to resolve dependencies of " + project.getArtifact(), e);
}
Expand Down Expand Up @@ -733,6 +736,14 @@ private AppArtifactCoords getDeploymentCoords() {
return deploymentCoords == null ? deploymentCoords = AppArtifactCoords.fromString(deployment) : deploymentCoords;
}

private CollectRequest newCollectRuntimeDepsRequest() throws MojoExecutionException {
return newCollectRequest(new DefaultArtifact(project.getArtifact().getGroupId(),
project.getArtifact().getArtifactId(),
project.getArtifact().getClassifier(),
project.getArtifact().getArtifactHandler().getExtension(),
project.getArtifact().getVersion()));
}

private CollectRequest newCollectRequest(DefaultArtifact projectArtifact) throws MojoExecutionException {
final ArtifactDescriptorResult projectDescr;
try {
Expand Down

0 comments on commit 3c079a6

Please sign in to comment.