Skip to content

Commit

Permalink
[MNG-8331] - Sometimes versioned dependencies disappear
Browse files Browse the repository at this point in the history
Avoid work when there are no dependencies
  • Loading branch information
jjkester committed Oct 19, 2024
1 parent 0e4401a commit 4963cd8
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -564,19 +564,21 @@ public void mergeRepositories(List<Repository> toAdd, boolean replace) {
// Infer inner reactor dependencies version
//
Model transformFileToRaw(Model model) {
if (model.getDependencies().isEmpty()) {
return model;
}
List<Dependency> newDeps = new ArrayList<>(model.getDependencies().size());
for (Dependency dep : model.getDependencies()) {
if (dep.getVersion() == null) {
Dependency.Builder depBuilder = null;
Model depModel = getRawModel(model.getPomFile(), dep.getGroupId(), dep.getArtifactId());
if (depModel != null) {
Dependency.Builder depBuilder = Dependency.newBuilder(dep);
String version = depModel.getVersion();
InputLocation versionLocation = depModel.getLocation("version");
if (version == null && depModel.getParent() != null) {
version = depModel.getParent().getVersion();
versionLocation = depModel.getParent().getLocation("version");
}
depBuilder = Dependency.newBuilder(dep);
depBuilder.version(version).location("version", versionLocation);
if (dep.getGroupId() == null) {
String depGroupId = depModel.getGroupId();
Expand All @@ -587,8 +589,6 @@ Model transformFileToRaw(Model model) {
}
depBuilder.groupId(depGroupId).location("groupId", groupIdLocation);
}
}
if (depBuilder != null) {
newDeps.add(depBuilder.build());
} else {
newDeps.add(dep);
Expand Down

0 comments on commit 4963cd8

Please sign in to comment.