From b69e6b379cc5ea46f0f72e9e41b233997b9957c4 Mon Sep 17 00:00:00 2001 From: Alexey Loubyansky Date: Mon, 15 Jul 2024 13:55:47 +0200 Subject: [PATCH] Gradle imageTask: look for builders among the dependencies of the runtime Quarkus application configuration instead of all the project configurations --- .../src/main/java/io/quarkus/gradle/tasks/ImageTask.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/ImageTask.java b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/ImageTask.java index 089c63db4caea..db657b5d037cf 100644 --- a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/ImageTask.java +++ b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/ImageTask.java @@ -11,6 +11,9 @@ import org.gradle.api.tasks.TaskAction; +import io.quarkus.gradle.dependency.ApplicationDeploymentClasspathBuilder; +import io.quarkus.runtime.LaunchMode; + public abstract class ImageTask extends QuarkusBuildTask { static final String QUARKUS_PREFIX = "quarkus-"; @@ -53,7 +56,9 @@ List availableBuilders() { // This will only pickup direct dependencies and not transitives // This means that extensions like quarkus-container-image-openshift via quarkus-openshift are not picked up // So, let's relax our filters a bit so that we can pickup quarkus-openshift directly (relax the prefix requirement). - return getProject().getConfigurations().stream().flatMap(c -> c.getDependencies().stream()) + return getProject().getConfigurations() + .getByName(ApplicationDeploymentClasspathBuilder.getFinalRuntimeConfigName(LaunchMode.NORMAL)) + .getDependencies().stream() .map(d -> d.getName()) .filter(n -> n.startsWith(QUARKUS_CONTAINER_IMAGE_PREFIX) || n.startsWith(QUARKUS_PREFIX)) .map(n -> n.replace(QUARKUS_CONTAINER_IMAGE_PREFIX, "").replace(QUARKUS_PREFIX, ""))