Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 61c3802

Browse files
authored
Grails 7 compatibility (#405)
- Update to Java 17 - Update to Grails 7 - Update to Groovy 4 - Update to Jakarta
1 parent 6695cb6 commit 61c3802

File tree

18 files changed

+54
-76
lines changed

18 files changed

+54
-76
lines changed

.github/renovate.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
},
1111
{
1212
"matchPackagePatterns": [
13-
"^org\\.codehaus\\.groovy"
13+
"^org\\.apache\\.groovy"
1414
],
1515
"groupName": "groovy monorepo"
1616
},

.github/workflows/docs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ jobs:
1515
- name: Set up JDK
1616
uses: actions/setup-java@v4
1717
with:
18-
distribution: 'adopt'
19-
java-version: '11'
18+
distribution: temurin
19+
java-version: 17
2020
- name: Checkout repository
2121
uses: actions/checkout@v4
2222
with:

.github/workflows/gradle.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
runs-on: ubuntu-latest
1414
strategy:
1515
matrix:
16-
java: ['11', '14']
16+
java: ['17']
1717
env:
1818
WORKSPACE: ${{ github.workspace }}
1919
GRADLE_OPTS: -Xmx1500m -Dfile.encoding=UTF-8
@@ -22,7 +22,7 @@ jobs:
2222
- name: Set up JDK
2323
uses: actions/setup-java@v4
2424
with:
25-
distribution: 'adopt'
25+
distribution: temurin
2626
java-version: ${{ matrix.java }}
2727
- name: Run Tests
2828
if: github.event_name == 'pull_request'
@@ -52,7 +52,7 @@ jobs:
5252
report_paths: '**/build/test-results/test/TEST-*.xml'
5353
- name: Publish to repo.grails.org
5454
id: publish
55-
if: steps.build.outcome == 'success' && github.event_name == 'push' && matrix.java == '11'
55+
if: steps.build.outcome == 'success' && github.event_name == 'push' && matrix.java == '17'
5656
uses: gradle/gradle-build-action@v3
5757
with:
5858
arguments: -Dorg.gradle.internal.publish.checksums.insecure=true publish
@@ -64,7 +64,7 @@ jobs:
6464
GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }}
6565
- name: Generate Docs
6666
id: docs
67-
if: steps.publish.outcome == 'success' && github.event_name == 'push' && matrix.java == '11'
67+
if: steps.publish.outcome == 'success' && github.event_name == 'push' && matrix.java == '17'
6868
uses: gradle/gradle-build-action@v3
6969
with:
7070
arguments: docs
@@ -73,7 +73,7 @@ jobs:
7373
GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }}
7474
GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }}
7575
- name: Publish to Github Pages
76-
if: steps.docs.outcome == 'success' && github.event_name == 'push' && matrix.java == '11'
76+
if: steps.docs.outcome == 'success' && github.event_name == 'push' && matrix.java == '17'
7777
uses: micronaut-projects/github-pages-deploy-action@master
7878
env:
7979
TARGET_REPOSITORY: ${{ github.repository }}

.github/workflows/groovy-joint-workflow.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ jobs:
127127
- name: Set up JDK
128128
uses: actions/setup-java@v4
129129
with:
130-
distribution: 'adopt'
131-
java-version: '11'
130+
distribution: temurin
131+
java-version: 17
132132
- name: Cache local Maven repository & Groovy
133133
uses: actions/cache@v4
134134
with:

.github/workflows/release.yml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ jobs:
1010
outputs:
1111
release_version: ${{ steps.release_version.outputs.value }}
1212
runs-on: ubuntu-latest
13-
strategy:
14-
matrix:
15-
java: ['11']
1613
steps:
1714
- name: Checkout repository
1815
uses: actions/checkout@v4
@@ -21,8 +18,8 @@ jobs:
2118
- name: Set up JDK
2219
uses: actions/setup-java@v4
2320
with:
24-
distribution: 'adopt'
25-
java-version: 11
21+
distribution: temurin
22+
java-version: 17
2623
- name: Set the current release version
2724
id: release_version
2825
run: echo "value=${GITHUB_REF:11}" >> $GITHUB_OUTPUT
@@ -78,8 +75,8 @@ jobs:
7875
- name: Set up JDK
7976
uses: actions/setup-java@v4
8077
with:
81-
distribution: 'adopt'
82-
java-version: '11'
78+
distribution: temurin
79+
java-version: 17
8380
- name: Checkout repository
8481
uses: actions/checkout@v4
8582
with:
@@ -114,8 +111,8 @@ jobs:
114111
- name: Set up JDK
115112
uses: actions/setup-java@v4
116113
with:
117-
distribution: 'adopt'
118-
java-version: '11'
114+
distribution: temurin
115+
java-version: 17
119116
- name: Checkout repository
120117
uses: actions/checkout@v4
121118
with:

.github/workflows/retry-release.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ on:
1111
jobs:
1212
release:
1313
runs-on: ubuntu-latest
14-
strategy:
15-
matrix:
16-
java: ['11']
1714
env:
1815
GIT_USER_NAME: puneetbehl
1916
GIT_USER_EMAIL: behlp@objectcomputing.com
@@ -27,8 +24,8 @@ jobs:
2724
- name: Set up JDK
2825
uses: actions/setup-java@v4
2926
with:
30-
distribution: 'adopt'
31-
java-version: ${{ matrix.java }}
27+
distribution: temurin
28+
java-version: 17
3229
- name: Extract Target Branch
3330
id: extract_branch
3431
run: |

build.gradle

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,16 @@ subprojects { project ->
2929

3030
ext['groovyVersion'] = System.getenv('CI_GROOVY_VERSION') ?: project.groovyVersion
3131

32+
configurations.configureEach {
33+
34+
// FORCE UPGRADE OF GROOVY IN DEPENDENCIES TO GROOVY 4
35+
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
36+
if (details.requested.group == 'org.codehaus.groovy') {
37+
details.useTarget(group: 'org.apache.groovy', name: details.requested.name, version: groovyVersion)
38+
}
39+
}
40+
}
41+
3242
ext {
3343
userOrg = "grails"
3444
isGrailsPlugin = name.startsWith('grails-plugin')
@@ -42,7 +52,6 @@ subprojects { project ->
4252
}
4353

4454
repositories {
45-
mavenLocal()
4655
maven { url "https://repo.grails.org/grails/core" }
4756
if (groovyVersion && groovyVersion.endsWith('-SNAPSHOT')) {
4857
maven {
@@ -64,30 +73,16 @@ subprojects { project ->
6473
apply from: "${commonBuild}/common-project.gradle"
6574
}
6675

67-
sourceCompatibility = 1.11
68-
targetCompatibility = 1.11
69-
}
70-
71-
configurations.all {
72-
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
73-
if (details.requested.group == 'org.springframework') {
74-
details.useVersion(springVersion)
75-
} else if (details.requested.group == 'org.springframework.boot') {
76-
details.useVersion(springBootVersion)
77-
} else if (details.requested.group == 'org.junit.jupiter') {
78-
details.useVersion(junitJupiterVersion)
79-
} else if (details.requested.group == 'org.junit.platform') {
80-
details.useVersion(junitPlatformVersion)
81-
}
82-
}
76+
sourceCompatibility = JavaVersion.VERSION_17
77+
targetCompatibility = JavaVersion.VERSION_17
8378
}
8479

8580
dependencies {
8681
implementation "com.github.javaparser:javaparser-core:$javaParserVersion"
87-
compileOnly "javax.servlet:javax.servlet-api:$servletApiVersion"
82+
compileOnly "jakarta.servlet:jakarta.servlet-api:$servletApiVersion"
8883

89-
testImplementation "javax.servlet:javax.servlet-api:$servletApiVersion"
90-
testImplementation "org.codehaus.groovy:groovy-test-junit5:$groovyVersion"
84+
testImplementation "jakarta.servlet:jakarta.servlet-api:$servletApiVersion"
85+
testImplementation "org.apache.groovy:groovy-test-junit5:$groovyVersion"
9186
testImplementation "org.junit.jupiter:junit-jupiter-api:$junitJupiterVersion"
9287
testImplementation "org.junit.platform:junit-platform-runner:$junitPlatformVersion"
9388
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitJupiterVersion"

examples/demo33/gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
grailsGradlePluginVersion=6.0.0
2-
grailsVersion=6.0.0
1+
grailsVersion=7.0.0-SNAPSHOT
2+
grailsGradlePluginVersion=6.2.0
33
org.gradle.daemon=true
44
org.gradle.parallel=true
55
org.gradle.jvmargs=-Dfile.encoding=UTF-8 -Xmx1024M

examples/demo33/grails-app/views/error.gsp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
<g:if test="${Throwable.isInstance(exception)}">
1111
<g:renderException exception="${exception}" />
1212
</g:if>
13-
<g:elseif test="${request.getAttribute('javax.servlet.error.exception')}">
14-
<g:renderException exception="${request.getAttribute('javax.servlet.error.exception')}" />
13+
<g:elseif test="${request.getAttribute('jakarta.servlet.error.exception')}">
14+
<g:renderException exception="${request.getAttribute('jakarta.servlet.error.exception')}" />
1515
</g:elseif>
1616
<g:else>
1717
<ul class="errors">

examples/demo33/src/test/groovy/demo/SubControllerSpec.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package demo
33
import grails.testing.web.controllers.ControllerUnitTest
44
import spock.lang.Specification
55

6-
import javax.servlet.http.HttpServletResponse
6+
import jakarta.servlet.http.HttpServletResponse
77

88
class SubControllerSpec extends Specification implements ControllerUnitTest<SubController> {
99
void 'test calling super method'() {

examples/demo33/src/test/groovy/demo/TestControllerSpec.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import org.grails.web.servlet.mvc.SynchronizerTokensHolder
77
import spock.lang.Ignore
88
import spock.lang.Specification
99

10-
import javax.servlet.http.HttpServletResponse
10+
import jakarta.servlet.http.HttpServletResponse
1111

1212
class TestControllerSpec extends Specification implements ControllerUnitTest<TestController>, DataTest {
1313

gradle.properties

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,23 @@ projectUrl=https://github.com/grails/grails-testing-support
66
githubSlug=grails/grails-testing-support
77
githubBranch=4.0.x
88
developers=Jeff Brown,James Kleeh
9-
grailsGradlePluginVersion=6.1.2
10-
grailsVersion=6.2.0
9+
grailsGradlePluginVersion=6.2.0
10+
grailsVersion=7.0.0-SNAPSHOT
1111
grailsDocsVersion=6.0.0
1212
asyncVersion=5.0.2
13-
groovyVersion=3.0.21
13+
groovyVersion=4.0.22
1414
gormVersion=8.1.2
1515
jsonViewsVersion=3.2.3
1616
junitPlatformVersion=1.10.2
1717
junitJupiterVersion=5.10.2
1818
gspVersion=6.2.1
19-
spockVersion=2.1-groovy-3.0
20-
springVersion=5.3.33
21-
springBootVersion=2.7.18
22-
slf4jVersion=1.7.22
19+
spockVersion=2.3-groovy-4.0
20+
springVersion=6.1.8
21+
springBootVersion=3.2.6
22+
slf4jVersion=1.7.36
2323
junitVersion=4.12
2424
javassistVersion=3.30.2-GA
25-
servletApiVersion=4.0.1
25+
servletApiVersion=6.0.0
2626
javaParserVersion=3.25.10
2727

2828
org.gradle.caching=true

grails-testing-support/build.gradle

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,3 @@
1-
configurations.all {
2-
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
3-
if(details.requested.group == 'org.springframework') {
4-
details.useVersion(springVersion)
5-
}
6-
else if(details.requested.group == 'org.springframework.boot') {
7-
details.useVersion(springBootVersion)
8-
}
9-
}
10-
}
11-
121
dependencies {
132
api "org.springframework:spring-test:$springVersion"
143
api("org.grails:grails-plugin-codecs:$grailsVersion") {
@@ -25,7 +14,7 @@ dependencies {
2514
api "org.springframework.boot:spring-boot-test:${springBootVersion}"
2615
api("org.spockframework:spock-spring:${spockVersion}") { transitive = false }
2716
api("org.spockframework:spock-core:${spockVersion}") { transitive = false }
28-
api "org.codehaus.groovy:groovy-test-junit5:$groovyVersion"
17+
api "org.apache.groovy:groovy-test-junit5:$groovyVersion"
2918
api "org.junit.jupiter:junit-jupiter-api:$junitJupiterVersion"
3019
api "org.junit.platform:junit-platform-runner:$junitPlatformVersion"
3120
runtimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitJupiterVersion"

grails-testing-support/src/main/groovy/org/grails/compiler/injection/testing/IntegrationTestMixinTransformation.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ class IntegrationTestMixinTransformation implements ASTTransformation {
134134
// @SpringBootTest
135135
def servletApi = null
136136
try {
137-
servletApi = Class.forName("javax.servlet.ServletContext", false, getClass().classLoader)
137+
servletApi = Class.forName("jakarta.servlet.ServletContext", false, getClass().classLoader)
138138
}
139139
catch(Exception e) {
140140
// ignore

grails-testing-support/src/main/groovy/org/grails/testing/GrailsApplicationBuilder.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ import org.springframework.util.ClassUtils
4444
@CompileStatic
4545
class GrailsApplicationBuilder {
4646

47-
public static final boolean isServletApiPresent = ClassUtils.isPresent('javax.servlet.ServletContext', GrailsApplicationBuilder.classLoader)
47+
public static final boolean isServletApiPresent = ClassUtils.isPresent('jakarta.servlet.ServletContext', GrailsApplicationBuilder.classLoader)
4848

4949
static final Set DEFAULT_INCLUDED_PLUGINS = ['core', 'eventBus'] as Set
5050

grails-web-testing-support/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ dependencies {
22
api "org.grails.plugins:gsp:$gspVersion"
33
api "org.grails:grails-plugin-rest:$grailsVersion"
44
api "org.grails:grails-plugin-interceptors:$grailsVersion"
5-
api "javax.servlet:javax.servlet-api:$servletApiVersion"
5+
api "jakarta.servlet:jakarta.servlet-api:$servletApiVersion"
66

77
api project(':grails-testing-support')
88
api "org.javassist:javassist:$javassistVersion"

grails-web-testing-support/src/main/groovy/org/grails/testing/spock/WebSetupInterceptor.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import org.spockframework.runtime.extension.IMethodInterceptor
1010
import org.spockframework.runtime.extension.IMethodInvocation
1111
import org.springframework.web.servlet.DispatcherServlet
1212

13-
import javax.servlet.ServletContext
13+
import jakarta.servlet.ServletContext
1414

1515
@CompileStatic
1616
class WebSetupInterceptor implements IMethodInterceptor {

settings.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@ include 'grails-testing-support',
3131
'grails-web-testing-support',
3232
'grails-gorm-testing-support'
3333

34-
include 'examples-demo33'
35-
project(":examples-demo33").projectDir = new File(settingsDir, "examples/demo33")
34+
//include 'examples-demo33'
35+
// project(":examples-demo33").projectDir = new File(settingsDir, "examples/demo33")
3636

0 commit comments

Comments
 (0)