Skip to content

Commit 85123f6

Browse files
committed
build: fix building with Groovy snapshots
- Resolve issues with building using a Groovy snapshot version. - Explicitly override the Groovy version in the build when requested, as it is now sourced from grails-bom instead of a property.
1 parent 6e59c57 commit 85123f6

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

build.gradle

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,41 @@ buildscript {
99
}
1010
}
1111

12+
group = 'org.grails'
13+
version = project.projectVersion
14+
1215
ext {
1316
isCiBuild = System.getenv('CI')
1417
isSnapshot = projectVersion.endsWith('-SNAPSHOT')
1518
isReleaseVersion = !isSnapshot
1619
excludeUnusedTransDeps = findProperty('excludeUnusedTransDeps')
1720
}
1821

19-
group = 'org.grails'
20-
version = project.projectVersion
22+
String customGroovyVersion = findProperty('groovyVersion') ?: System.getenv('GROOVY_VERSION')
23+
if (customGroovyVersion) {
24+
logger.lifecycle("Using custom Groovy version: $customGroovyVersion")
25+
}
2126

2227
allprojects {
28+
29+
if (customGroovyVersion) {
30+
configurations.configureEach {
31+
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
32+
if (details.requested.group == 'org.apache.groovy') {
33+
details.useVersion(customGroovyVersion)
34+
}
35+
}
36+
}
37+
}
38+
2339
repositories {
2440
mavenCentral()
2541
maven { url = 'https://repo.grails.org/grails/core' }
2642
// mavenLocal() // Keep, this will be uncommented and used by CI (groovy-joint-workflow)
27-
if (findProperty('groovyVersion')?.endsWith('-SNAPSHOT')) {
28-
logger.lifecycle('Adding Groovy Snapshot Repo for project: {}, Using Groovy {}', name, findProperty('groovyVersion'))
43+
if (customGroovyVersion?.endsWith('-SNAPSHOT')) {
44+
// Used for testing locally against the latest snapshot of Groovy
45+
// Usage: ./gradlew build -P"groovyVersion=X.X.X-SNAPSHOT"
46+
logger.lifecycle('Adding Groovy Snapshot Repo for project: {}, Using Groovy {}', name, customGroovyVersion)
2947
maven {
3048
name = 'ASF Snapshot repo'
3149
url = 'https://repository.apache.org/content/repositories/snapshots'

0 commit comments

Comments
 (0)