@@ -167,6 +167,9 @@ ext {
167167 def deps = depMgmt?. dependencies?. getAt(0 )
168168 if (deps) {
169169 Map<String , String > pomProperties = [:]
170+ PropertyNameCalculator propertyNameCalculator = new PropertyNameCalculator (combinedPlatforms, combinedDependencies, combinedVersions)
171+ propertyNameCalculator. addProjects(rootProject. subprojects, projectVersion)
172+
170173 deps. dependency. each { dep ->
171174 String groupId = dep. groupId. text(). trim()
172175 String artifactId = dep. artifactId. text(). trim()
@@ -178,8 +181,6 @@ ext {
178181 }
179182
180183 if (inlineVersion) {
181- PropertyNameCalculator propertyNameCalculator = new PropertyNameCalculator (combinedPlatforms, combinedDependencies, combinedVersions)
182- propertyNameCalculator. addProjects(rootProject. subprojects)
183184 ExtractedDependencyConstraint extractedConstraint = propertyNameCalculator. calculate(groupId, artifactId, inlineVersion, isBom)
184185 if (extractedConstraint?. versionPropertyReference) {
185186 // use the property reference instead of the hard coded version so that it can be
@@ -190,18 +191,17 @@ ext {
190191 pomProperties. put(extractedConstraint. versionPropertyName, inlineVersion)
191192 }
192193
193- if (gradle. includedBuilds* . any { it. name == artifactId && groupId. startsWith(' org.apache.grails' ) }) {
194- String baseVersionName = artifactId. replaceAll(' -' , ' .' )
195- String versionName = " ${ baseVersionName} .version" as String
196- dep. version[0 ]. value = " \$ {${ versionName} }" as String
197- pomProperties. put(versionName, inlineVersion)
194+ // For included builds (grails-gradle), also use grails.version
195+ if (gradle. includedBuilds. any { it. name == artifactId && groupId. startsWith(' org.apache.grails' ) }) {
196+ dep. version[0 ]. value = " \$ {${ PropertyNameCalculator.GRAILS_VERSION_PROPERTY} }" as String
197+ pomProperties. put(PropertyNameCalculator . GRAILS_VERSION_PROPERTY , inlineVersion)
198198 }
199199 } else if (! inlineVersion) {
200200 throw new GradleException (" Dependency $groupId :$artifactId does not have a version." )
201201 }
202202 }
203203
204- for (Map.Entry < String , String > property : pomProperties. entrySet()) {
204+ for (Map.Entry < String , String > property : pomProperties. sort() . entrySet()) {
205205 propertiesNode. appendNode(property. key, property. value)
206206 }
207207 }
0 commit comments