Skip to content

Commit 4b37433

Browse files
authored
util/maven: do not add dependency management when version is empty (#357)
Maven POMs may contain `<dependencyManagement>` entries without a `version` field. Previously, `ProcessDependencies` stored these versionless entries, preventing dependency management with the actual version constraint to be stored. This PR updated `addDepManagement` in `util/maven/dependency.go` to explicitly require `dep.Version != ""` before adding an entry to the map.
1 parent 7863f23 commit 4b37433

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

util/maven/dependency.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,9 @@ func (p *Project) ProcessDependencies(getDependencyManagement func(String, Strin
118118
continue
119119
}
120120
dk := dep.Key()
121-
if _, ok := m[dk]; !ok {
121+
if _, ok := m[dk]; !ok && dep.Version != "" {
122+
// Only add dependency management when it is not in the map and
123+
// the version is not empty.
122124
m[dk] = dep
123125
keys = append(keys, dk)
124126
}

0 commit comments

Comments
 (0)