diff --git a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/QuarkusPlugin.java b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/QuarkusPlugin.java index 1dc5149b41b73..1274a414b4f70 100644 --- a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/QuarkusPlugin.java +++ b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/QuarkusPlugin.java @@ -242,19 +242,19 @@ private void registerConditionalDependencies(Project project) { Set implementationExtensions = conditionalDependenciesEnabler .declareConditionalDependencies(JavaPlugin.IMPLEMENTATION_CONFIGURATION_NAME); deploymentClasspathBuilder.createBuildClasspath(implementationExtensions, - JavaPlugin.IMPLEMENTATION_CONFIGURATION_NAME, true); + JavaPlugin.IMPLEMENTATION_CONFIGURATION_NAME); }); project.getConfigurations().getByName(DEV_MODE_CONFIGURATION_NAME).getIncoming().beforeResolve((devDependencies) -> { Set devModeExtensions = conditionalDependenciesEnabler .declareConditionalDependencies(DEV_MODE_CONFIGURATION_NAME); - deploymentClasspathBuilder.createBuildClasspath(devModeExtensions, DEV_MODE_CONFIGURATION_NAME, false); + deploymentClasspathBuilder.createBuildClasspath(devModeExtensions, DEV_MODE_CONFIGURATION_NAME); }); project.getConfigurations().getByName(JavaPlugin.TEST_COMPILE_CLASSPATH_CONFIGURATION_NAME).getIncoming() .beforeResolve((testDependencies) -> { Set testExtensions = conditionalDependenciesEnabler .declareConditionalDependencies(JavaPlugin.TEST_IMPLEMENTATION_CONFIGURATION_NAME); deploymentClasspathBuilder.createBuildClasspath(testExtensions, - JavaPlugin.TEST_IMPLEMENTATION_CONFIGURATION_NAME, false); + JavaPlugin.TEST_IMPLEMENTATION_CONFIGURATION_NAME); }); } diff --git a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/dependency/ApplicationDeploymentClasspathBuilder.java b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/dependency/ApplicationDeploymentClasspathBuilder.java index 6d9332c6d743d..45827d9fd74ec 100644 --- a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/dependency/ApplicationDeploymentClasspathBuilder.java +++ b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/dependency/ApplicationDeploymentClasspathBuilder.java @@ -12,7 +12,7 @@ public class ApplicationDeploymentClasspathBuilder { private static final String DEPLOYMENT_CONFIGURATION_SUFFIX = "Deployment"; private final Project project; - private final Set commonExtensions = new HashSet<>(); + private final Set alreadyProcessed = new HashSet<>(); public ApplicationDeploymentClasspathBuilder(Project project) { this.project = project; @@ -22,19 +22,18 @@ public static String toDeploymentConfigurationName(String baseConfigurationName) return baseConfigurationName + DEPLOYMENT_CONFIGURATION_SUFFIX; } - public void createBuildClasspath(Set extensions, String baseConfigurationName, boolean common) { + public synchronized void createBuildClasspath(Set extensions, String baseConfigurationName) { String deploymentConfigurationName = toDeploymentConfigurationName(baseConfigurationName); project.getConfigurations().create(deploymentConfigurationName); DependencyHandler dependencies = project.getDependencies(); for (ExtensionDependency extension : extensions) { - if (common) { - commonExtensions.add(extension); - } else if (commonExtensions.contains(extension)) { + requireDeploymentDependency(deploymentConfigurationName, extension, dependencies); + if (alreadyProcessed.contains(extension)) { continue; } + alreadyProcessed.add(extension); extension.createDeploymentVariant(dependencies); - requireDeploymentDependency(deploymentConfigurationName, extension, dependencies); } }