Skip to content

Commit 90917e4

Browse files
committed
build: turn off springDependencyManagement for test apps
- To prevent unexpected versions being pulled in - Also use type-safe API when configuring GrailsExtension
1 parent 3a8c1c6 commit 90917e4

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

gradle/plugin-config.gradle

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@
1717
* under the License.
1818
*/
1919

20+
import org.grails.gradle.plugin.core.GrailsExtension
21+
2022
// The plugins do not have an Application class and are not runnable by themselves
2123
tasks.named('bootRun') { enabled = false }
2224
tasks.named('findMainClass') { enabled = false }
2325

24-
grails {
25-
// turn off dependency management so we *know* we're testing with the right versions and not from a remote repository
26-
springDependencyManagement = false
26+
extensions.configure(GrailsExtension) {
27+
// Explicit `it` is required in extension configuration blocks
28+
it.springDependencyManagement = false
2729
}

gradle/test-config.gradle

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
* under the License.
1818
*/
1919

20+
import org.grails.gradle.plugin.core.GrailsExtension
21+
2022
dependencies {
2123
// In Gradle 9, this needs to be declared
2224
// https://docs.gradle.org/8.3/userguide/upgrading_version_8.html#test_framework_implementation_dependencies
@@ -50,4 +52,12 @@ tasks.named('integrationTest', Test) {
5052
grailsVersion
5153
)
5254
}
55+
}
56+
57+
extensions.configure(GrailsExtension) {
58+
// Explicit `it` is required in extension configuration blocks
59+
60+
// turn off dependency management so we *know* we're testing with the right
61+
// versions and not from a remote repository
62+
it.springDependencyManagement = false
5363
}

0 commit comments

Comments
 (0)