Skip to content

Commit 0e4401a

Browse files
committed
[MNG-8331] Sometimes versioned dependencies disappear
Ensure all dependencies end up in the model
1 parent 912c117 commit 0e4401a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

maven-api-impl/src/main/java/org/apache/maven/internal/impl/model/DefaultModelBuilder.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -564,8 +564,7 @@ public void mergeRepositories(List<Repository> toAdd, boolean replace) {
564564
// Infer inner reactor dependencies version
565565
//
566566
Model transformFileToRaw(Model model) {
567-
List<Dependency> newDeps = new ArrayList<>();
568-
boolean modified = false;
567+
List<Dependency> newDeps = new ArrayList<>(model.getDependencies().size());
569568
for (Dependency dep : model.getDependencies()) {
570569
if (dep.getVersion() == null) {
571570
Dependency.Builder depBuilder = null;
@@ -591,13 +590,14 @@ Model transformFileToRaw(Model model) {
591590
}
592591
if (depBuilder != null) {
593592
newDeps.add(depBuilder.build());
594-
modified = true;
595593
} else {
596594
newDeps.add(dep);
597595
}
596+
} else {
597+
newDeps.add(dep);
598598
}
599599
}
600-
return modified ? model.withDependencies(newDeps) : model;
600+
return model.withDependencies(newDeps);
601601
}
602602

603603
String replaceCiFriendlyVersion(Map<String, String> properties, String version) {

0 commit comments

Comments
 (0)