@@ -84,10 +84,24 @@ tasks.withType(Test).configureEach {
8484 if (testdb) {
8585 systemProperty ' groovy.testdb.props' , testdb
8686 }
87- // Forward StrictLocalM2Resolver opt-in to test JVMs. Accepts -P or -D.
88- def strictLocalM2 = findProperty(' groovy.grape.strict-localm2' ) ?: System . properties[' groovy.grape.strict-localm2' ]
89- if (strictLocalM2) {
90- systemProperty ' groovy.grape.strict-localm2' , strictLocalM2
87+ // Forward any groovy.grape.* property set on the Gradle command line (-P or -D)
88+ // to the test JVM. Lets users override Grape behaviour — strict-localm2, debug
89+ // flags, future settings — without adding one-off plumbing per flag. Project
90+ // properties (-P) win over system properties (-D) when both are set, matching
91+ // Gradle convention.
92+ def grapeProps = new LinkedHashMap<String , String > ()
93+ project. properties. each { k , v ->
94+ if (k. toString(). startsWith(' groovy.grape.' ) && v != null ) {
95+ grapeProps[k. toString()] = v. toString()
96+ }
97+ }
98+ System . properties. each { k , v ->
99+ if (k. toString(). startsWith(' groovy.grape.' ) && v != null ) {
100+ grapeProps. putIfAbsent(k. toString(), v. toString())
101+ }
102+ }
103+ grapeProps. each { key , value ->
104+ systemProperty key, value
91105 }
92106 def headless = System . properties[' java.awt.headless' ]
93107 if (headless == ' true' ) {
0 commit comments