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..4be1d8ce212 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
@@ -1,5 +1,5 @@
/*
- * Copyright 2014 original authors
+ * Copyright 2014-2024 original authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -68,10 +68,37 @@ 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) {
+ version?.startsWith('${') && version?.endsWith('}') ?
+ versionProperties[version[2..-2]] : version
}
protected void addDependency(String group, String artifactId, String version) {