diff --git a/devtools/gradle/src/main/java/io/quarkus/gradle/builder/QuarkusModelBuilder.java b/devtools/gradle/src/main/java/io/quarkus/gradle/builder/QuarkusModelBuilder.java index cdc0bd5327a8a..ac70d8c8e8095 100644 --- a/devtools/gradle/src/main/java/io/quarkus/gradle/builder/QuarkusModelBuilder.java +++ b/devtools/gradle/src/main/java/io/quarkus/gradle/builder/QuarkusModelBuilder.java @@ -1,10 +1,11 @@ package io.quarkus.gradle.builder; import java.io.File; +import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; import java.util.HashSet; import java.util.LinkedHashMap; -import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Objects; @@ -68,7 +69,8 @@ private static Configuration classpathConfig(Project project, LaunchMode mode) { return project.getConfigurations().getByName(JavaPlugin.RUNTIME_CLASSPATH_CONFIGURATION_NAME); } - private static Configuration deploymentClasspathConfig(Project project, LaunchMode mode) { + private static Configuration deploymentClasspathConfig(Project project, LaunchMode mode, + Collection platforms) { Configuration deploymentConfiguration = project.getConfigurations().findByName(DEPLOYMENT_CONFIGURATION); if (deploymentConfiguration != null) { @@ -76,6 +78,7 @@ private static Configuration deploymentClasspathConfig(Project project, LaunchMo } deploymentConfiguration = project.getConfigurations().create(DEPLOYMENT_CONFIGURATION) + .withDependencies(ds -> ds.addAll(platforms)) .extendsFrom(project.getConfigurations().getByName(ApplicationDeploymentClasspathBuilder .toDeploymentConfigurationName(JavaPlugin.IMPLEMENTATION_CONFIGURATION_NAME))); if (LaunchMode.TEST.equals(mode)) { @@ -118,7 +121,7 @@ public Object buildAll(String modelName, ModelParameter parameter, Project proje final ResolvedConfiguration resolvedConfiguration = classpathConfig.getResolvedConfiguration(); collectDependencies(resolvedConfiguration, mode, project, appDependencies); - Configuration deploymentConfig = deploymentClasspathConfig(project, mode); + Configuration deploymentConfig = deploymentClasspathConfig(project, mode, deploymentDeps); final List extensionDependencies = collectExtensionDependencies(deploymentConfig); ArtifactCoords appArtifactCoords = new ArtifactCoordsImpl(project.getGroup().toString(), project.getName(), @@ -126,7 +129,7 @@ public Object buildAll(String modelName, ModelParameter parameter, Project proje return new QuarkusModelImpl( new WorkspaceImpl(appArtifactCoords, getWorkspace(project.getRootProject(), mode, appArtifactCoords)), - new LinkedList<>(appDependencies.values()), + new ArrayList<>(appDependencies.values()), extensionDependencies, deploymentDeps.stream().map(QuarkusModelBuilder::toEnforcedPlatformDependency) .filter(Objects::nonNull).collect(Collectors.toList()), @@ -209,18 +212,15 @@ private WorkspaceModule getWorkspaceModule(Project project, LaunchMode mode, boo } private List collectExtensionDependencies(Configuration deploymentConfiguration) { - final List platformDependencies = new LinkedList<>(); - + final List extensionDependencies = new ArrayList<>(); final ResolvedConfiguration rc = deploymentConfiguration.getResolvedConfiguration(); for (ResolvedArtifact a : rc.getResolvedArtifacts()) { - if (!isDependency(a)) { - continue; + if (isDependency(a)) { + extensionDependencies.add(toDependency(a)); } - final Dependency dependency = toDependency(a); - platformDependencies.add(dependency); } - return platformDependencies; + return extensionDependencies; } private void collectDependencies(ResolvedConfiguration configuration,