Skip to content

Commit 9758552

Browse files
bclozelartembilan
authored andcommitted
Add managed dependency versions to generated POM
Since the dependendency management Gradle plugin is applied and the Jackson BOM is used, versions for this artifact are resolved by the plugin. The plugin configuration in this build disables POM customization, as otherwise it would add `<dependendencyManagement>` sections in the generated POMs. This commit adds a missing script in the 2.1.x branch that checks the generated POM for missing versions in dependencies and uses the information provided by the dependency management plugin to add those back. Fixes gh-1082
1 parent e654022 commit 9758552

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

publish-maven.gradle

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,16 @@ install {
1414

1515
def customizePom(pom, gradleProject) {
1616
pom.whenConfigured { generatedPom ->
17+
18+
// sort to make pom dependencies order consistent to ease comparison of older poms
19+
generatedPom.dependencies = generatedPom.dependencies.sort { dep ->
20+
"$dep.scope:$dep.groupId:$dep.artifactId"
21+
}
22+
23+
def managedVersions = dependencyManagement.managedVersions
24+
generatedPom.dependencies.findAll{dep -> !dep.version }.each { dep ->
25+
dep.version = managedVersions["${dep.groupId}:${dep.artifactId}"]
26+
}
1727
// respect 'optional' and 'provided' dependencies
1828
gradleProject.optionalDeps.each { dep ->
1929
generatedPom.dependencies.find { it.artifactId == dep.name }?.optional = true

0 commit comments

Comments
 (0)