diff --git a/grails-shell/src/main/groovy/org/grails/cli/boot/GrailsDependencyVersions.groovy b/grails-shell/src/main/groovy/org/grails/cli/boot/GrailsDependencyVersions.groovy index 5e9530312e9..ded687926e2 100644 --- a/grails-shell/src/main/groovy/org/grails/cli/boot/GrailsDependencyVersions.groovy +++ b/grails-shell/src/main/groovy/org/grails/cli/boot/GrailsDependencyVersions.groovy @@ -68,10 +68,40 @@ class GrailsDependencyVersions implements DependencyManagement { @CompileDynamic void addDependencyManagement(GPathResult pom) { + versionProperties = pom.properties.'*'.collectEntries { [(it.name()): it.text()] } pom.dependencyManagement.dependencies.dependency.each { dep -> - addDependency(dep.groupId.text(), dep.artifactId.text(), dep.version.text()) + addDependency(dep.groupId.text(), dep.artifactId.text(), versionLookup(dep.version.text())) } - versionProperties = pom.properties.'*'.collectEntries { [(it.name()): it.text()] } + } + + /** + * Handles properties version lookup in grails-bom + * + * + * 1.10.15 + * + * + * + * + * + * org.apache.ant + * ant + * ${ant.version} + * + * + * + * + * @param version + * either the version or the version to lookup + * + * @return the version with lookup from properties when required + */ + String versionLookup(String version){ + if (version?.startsWith('${') && version?.endsWith('}')) { + return versionProperties.get(version.substring(2, version.length()-1)) + } + + return version } protected void addDependency(String group, String artifactId, String version) {