Skip to content

Commit

Permalink
build: enforce Groovy version override
Browse files Browse the repository at this point in the history
Setting `groovy.version` property does not seem to suffice to override the groovy version in the bom.
  • Loading branch information
matrei committed Jan 1, 2025
1 parent 3fe24e4 commit 999140f
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ ext.set('grailsVersion', libs.versions.grails.get())
ext.set('isSnapshot', projectVersion.endsWith('-SNAPSHOT'))
ext.set('isReleaseVersion', !isSnapshot)

def groovyVersion = findProperty('groovyVersion') ?: System.getenv('GROOVY_VERSION')
if (groovyVersion) {
ext.set('groovy.version', groovyVersion)
String customGroovyVersion = findProperty('groovyVersion') ?: System.getenv('GROOVY_VERSION')
if (customGroovyVersion) {
logger.warn("Using custom Groovy version: $customGroovyVersion")
}

if(isReleaseVersion) {
if (isReleaseVersion) {
nexusPublishing {
String nexusUser = System.getenv('SONATYPE_USERNAME')
String nexusPass = System.getenv('SONATYPE_PASSWORD')
Expand All @@ -36,13 +36,24 @@ subprojects {
apply plugin: 'groovy'

version = rootProject.version

if (customGroovyVersion) {
configurations.configureEach {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'org.apache.groovy') {
details.useVersion(customGroovyVersion)
}
}
}
}

repositories {
mavenCentral()
maven { url = 'https://repo.grails.org/grails/core' }
// mavenLocal() // Keep, this will be uncommented and used by CI (groovy-joint-workflow)
if (groovyVersion?.endsWith('-SNAPSHOT')) {
if (customGroovyVersion?.endsWith('-SNAPSHOT')) {
// Used for testing locally against the latest snapshot of Groovy
// Usage: ./gradlew -PgroovyVersion=X.X.X-SNAPSHOT build
// Usage: ./gradlew build -P"groovyVersion=X.X.X-SNAPSHOT"
maven {
name = 'ASF Snapshot repo'
url = 'https://repository.apache.org/content/repositories/snapshots'
Expand Down

0 comments on commit 999140f

Please sign in to comment.