jdaugherty commented on code in PR #15730:
URL: https://github.com/apache/grails-core/pull/15730#discussion_r3433053418


##########
grails-shell-cli/src/main/groovy/org/grails/cli/boot/GrailsDependencyVersions.groovy:
##########
@@ -85,27 +86,62 @@ class GrailsDependencyVersions implements 
DependencyManagement {
 
     @CompileDynamic
     void addDependencyManagement(GPathResult pom) {
-        versionProperties = pom.properties.'*'.collectEntries { [(it.name()): 
it.text()] }
+        // Capture this POM's <properties> in a local map so that ${...} 
version references are
+        // resolved against the POM that declared them, and so recursing into 
an imported BOM
+        // cannot clobber the property table mid-iteration. Merge into the 
shared map with
+        // first-writer-wins precedence so Grails' own versions win over 
imported BOM versions.
+        Map<String, String> localProperties = 
pom.properties.'*'.collectEntries { [(it.name()): it.text()] }
+        localProperties.each { String key, String value -> 
versionProperties.putIfAbsent(key, value) }
+
+        List<Map<String, String>> grailsImports = []
+        List<Map<String, String>> thirdPartyImports = []
+
         pom.dependencyManagement.dependencies.dependency.each { dep ->
             String groupId = dep.groupId.text()
             String artifactId = dep.artifactId.text()
-            String version = versionLookup(dep.version.text())
+            String version = versionLookup(dep.version.text(), localProperties)
             String scope = dep.scope.text()

Review Comment:
   This is a lot of logic for resolving what should be recursive. It was 
claimed this was to fix the shell cli.  Can you please elaborate how this was 
broken?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to