diff --git a/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/MutableJarApplicationModel.java b/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/MutableJarApplicationModel.java index ebceb7d97089f..db561e98b8774 100644 --- a/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/MutableJarApplicationModel.java +++ b/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/MutableJarApplicationModel.java @@ -4,7 +4,6 @@ import java.nio.file.Path; import java.util.ArrayList; import java.util.Collection; -import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -41,14 +40,21 @@ public MutableJarApplicationModel(String baseName, Map String userProvidersDirectory, String appArchivePath) { this.baseName = baseName; this.userProvidersDirectory = userProvidersDirectory; - appArtifact = new SerializedDep(appModel.getAppArtifact(), paths, 0); - appArtifact.paths = Collections.singletonList(appArchivePath.replace('\\', '/')); + appArtifact = new SerializedDep(appModel.getAppArtifact(), + paths.getOrDefault(appModel.getAppArtifact().getKey(), List.of()), 0); + appArtifact.paths = List.of(appArchivePath.replace('\\', '/')); + localProjectArtifacts = new HashSet<>(appModel.getReloadableWorkspaceDependencies()); + excludedResources = new HashMap<>(appModel.getRemovedResources()); dependencies = new ArrayList<>(appModel.getDependencies().size()); for (ResolvedDependency i : appModel.getDependencies()) { - dependencies.add(new SerializedDep(i, paths, i.getFlags())); + final List pathList = paths.get(i.getKey()); + if (pathList != null && !pathList.isEmpty()) { + dependencies.add(new SerializedDep(i, pathList, i.getFlags())); + } else { + localProjectArtifacts.remove(i.getKey()); + excludedResources.remove(i.getKey()); + } } - localProjectArtifacts = new HashSet<>(appModel.getReloadableWorkspaceDependencies()); - excludedResources = new HashMap<>(appModel.getRemovedResources()); capabilitiesContracts = new ArrayList<>(appModel.getExtensionCapabilities()); this.platformImports = appModel.getPlatforms(); } @@ -83,15 +89,11 @@ private static class SerializedDep extends GACTV { private List paths; private final int flags; - public SerializedDep(ResolvedDependency dependency, Map> paths, int flags) { + public SerializedDep(ResolvedDependency dependency, List paths, int flags) { super(dependency.getGroupId(), dependency.getArtifactId(), dependency.getClassifier(), dependency.getType(), dependency.getVersion()); - List pathList = paths.get(dependency.getKey()); - if (pathList == null) { - pathList = Collections.emptyList(); - } - this.paths = pathList.stream().map(s -> s.replace('\\', '/')).collect(Collectors.toList()); + this.paths = paths.stream().map(s -> s.replace('\\', '/')).collect(Collectors.toList()); this.flags = flags; } @@ -104,6 +106,7 @@ public ResolvedDependencyBuilder getDep(Path root) { .setGroupId(getGroupId()) .setArtifactId(getArtifactId()) .setClassifier(getClassifier()) + .setType(getType()) .setVersion(getVersion()) .setResolvedPaths(builder.build()) .setFlags(flags);