Skip to content

Commit 80f6c14

Browse files
authored
Grails-156: Update to Grails Redis Plugin to be compatible with Grails 7.x.x (#158)
1 parent 57df472 commit 80f6c14

File tree

30 files changed

+270
-345
lines changed

30 files changed

+270
-345
lines changed

.github/workflows/gradle.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ jobs:
1919
- name: Set up JDK
2020
uses: actions/setup-java@v4
2121
with:
22-
distribution: 'adopt'
23-
java-version: 11
22+
distribution: 'liberica'
23+
java-version: 17
2424
- name: Setup Redis
2525
uses: supercharge/redis-github-action@1.8.0
2626
with:
@@ -31,7 +31,7 @@ jobs:
3131
env:
3232
REDIS_HOST: redis
3333
REDIS_PORT: 6379
34-
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
34+
DEVELOCITY_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
3535
with:
3636
arguments: build -Dgeb.env=chromeHeadless
3737
publish:
@@ -42,8 +42,8 @@ jobs:
4242
- uses: actions/checkout@v4
4343
- uses: actions/setup-java@v4
4444
with:
45-
distribution: 'adopt'
46-
java-version: 11
45+
distribution: 'liberica'
46+
java-version: 17
4747
- name: Publish Artifacts (repo.grails.org)
4848
id: publish
4949
uses: gradle/gradle-build-action@v2
@@ -70,5 +70,5 @@ jobs:
7070
BRANCH: gh-pages
7171
FOLDER: plugin/build/docs
7272
DOC_FOLDER: gh-pages
73-
COMMIT_EMAIL: behlp@unityfoundation.io
74-
COMMIT_NAME: Puneet Behl
73+
COMMIT_EMAIL: 'grails-build@users.noreply.github.com'
74+
COMMIT_NAME: 'grails-build'

.github/workflows/release.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ jobs:
66
release:
77
runs-on: ubuntu-latest
88
env:
9-
GIT_USER_NAME: puneetbehl
10-
GIT_USER_EMAIL: behlp@unityfoundation.io
9+
GIT_USER_NAME: 'grails-build'
10+
GIT_USER_EMAIL: 'grails-build@users.noreply.github.com'
1111
steps:
1212
- name: Checkout repository
1313
uses: actions/checkout@v4
@@ -16,8 +16,8 @@ jobs:
1616
- name: Set up JDK
1717
uses: actions/setup-java@v4
1818
with:
19-
distribution: 'adopt'
20-
java-version: '11'
19+
distribution: 'liberica'
20+
java-version: '17'
2121
- name: Set the current release version
2222
id: release_version
2323
run: echo ::set-output name=release_version::${GITHUB_REF:11}
@@ -60,8 +60,8 @@ jobs:
6060
BRANCH: gh-pages
6161
FOLDER: plugin/build/docs
6262
DOC_FOLDER: gh-pages
63-
COMMIT_EMAIL: behlp@unityfoundation.io
64-
COMMIT_NAME: Puneet Behl
63+
COMMIT_EMAIL: ${{ env.GIT_USER_EMAIL }}
64+
COMMIT_NAME: ${{ env.GIT_USER_NAME }}
6565
VERSION: ${{ steps.release_version.outputs.release_version }}
6666
- name: Run post-release
6767
if: success()

build.gradle

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1+
12
plugins {
2-
id 'io.github.gradle-nexus.publish-plugin' version '1.3.0'
3+
id "java-library"
4+
id "org.grails.internal.grails-plugin-publish"
5+
id "org.grails.grails-gsp"
6+
id "org.grails.grails-plugin"
37
}
48

5-
ext.isSnapshot = project.projectVersion.endsWith('-SNAPSHOT')
6-
ext.isReleaseVersion = !isSnapshot
7-
ext."signing.keyId" = project.hasProperty("signing.keyId") ? project.getProperty('signing.keyId') : System.getenv('SIGNING_KEY')
8-
ext."signing.secretKeyRingFile" = project.hasProperty("signing.secretKeyRingFile") ? project.getProperty('signing.secretKeyRingFile') : "${System.properties['user.home']}${File.separator}.gnupg${File.separator}secring.gpg"
9-
ext."signing.password" = project.hasProperty("signing.password") ? project.getProperty('signing.password') : System.getenv('SIGNING_PASSPHRASE')
10-
119
version = project.projectVersion
10+
group = 'org.grails.plugins'
1211

1312
allprojects {
1413

@@ -24,21 +23,13 @@ allprojects {
2423
}
2524
}
2625

27-
if (isReleaseVersion) {
28-
apply plugin: "io.github.gradle-nexus.publish-plugin"
29-
30-
nexusPublishing {
31-
repositories {
32-
sonatype {
33-
def ossUser = System.getenv("SONATYPE_USERNAME") ?: project.hasProperty("sonatypeOssUsername") ? project.sonatypeOssUsername : ''
34-
def ossPass = System.getenv("SONATYPE_PASSWORD") ?: project.hasProperty("sonatypeOssPassword") ? project.sonatypeOssPassword : ''
35-
def ossStagingProfileId = System.getenv("SONATYPE_STAGING_PROFILE_ID") ?: project.hasProperty("sonatypeOssStagingProfileId") ? project.sonatypeOssStagingProfileId : ''
36-
nexusUrl = uri("https://s01.oss.sonatype.org/service/local/")
37-
snapshotRepositoryUrl = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
38-
username = ossUser
39-
password = ossPass
40-
stagingProfileId = ossStagingProfileId
41-
}
42-
}
26+
grailsPublish {
27+
userOrg = 'grails'
28+
githubSlug = 'grails/redis'
29+
license {
30+
name = 'Apache-2.0'
4331
}
44-
}
32+
title = 'Grails Redis Plugin'
33+
desc = 'This Plugin provides access to Redis and various utilities(service, annotations, etc) for caching.'
34+
developers = [puneetbehl: 'Puneet Behl']
35+
}

buildSrc/build.gradle

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apply from: "./loadProps.gradle"
2+
3+
repositories {
4+
mavenCentral()
5+
maven { url "https://repo.grails.org/grails/core" }
6+
maven {
7+
url = 'https://repo.gradle.org/gradle/libs-releases'
8+
description = 'Needed for Gradle Tooling API'
9+
}
10+
}
11+
dependencies {
12+
implementation "com.bertramlabs.plugins:asset-pipeline-gradle:${assetPipelineGrailVersion}"
13+
implementation "org.grails:grails-gradle-plugin:${grailsVersion}"
14+
implementation "org.gradle:gradle-tooling-api:${gradleToolingApiVersion}"
15+
}

buildSrc/loadProps.gradle

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Properties properties = new Properties()
2+
FileInputStream input = new FileInputStream(file("${rootDir.parentFile}/gradle.properties"))
3+
properties.load(input)
4+
input.close()
5+
6+
for (String key : properties.stringPropertyNames()) {
7+
ext.set(key, properties.getProperty(key))
8+
}

examples/redis-demo/build.gradle

Lines changed: 33 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,27 @@
1-
buildscript {
2-
repositories {
3-
maven { url "https://repo.grails.org/grails/core" }
4-
}
5-
dependencies {
6-
classpath "org.grails:grails-gradle-plugin:$grailsGradlePluginVersion"
7-
classpath "com.bertramlabs.plugins:asset-pipeline-gradle:4.3.0"
8-
}
9-
}
10-
11-
version "0.1"
12-
group "com.example"
131

14-
apply plugin: "war"
15-
apply plugin: 'eclipse'
16-
apply plugin: 'idea'
17-
apply plugin: "org.grails.grails-web"
18-
apply plugin:"com.bertramlabs.asset-pipeline"
19-
apply plugin: "org.grails.grails-gsp"
2+
plugins {
3+
id "war"
4+
id 'eclipse'
5+
id 'idea'
6+
id "org.grails.grails-web"
7+
id "com.bertramlabs.asset-pipeline"
8+
id "org.grails.grails-gsp"
9+
id "application"
10+
}
2011

12+
version = project.projectVersion
13+
group = "com.example"
2114
assets {
2215
minifyJs = true
2316
minifyCss = true
2417
}
2518

19+
java {
20+
toolchain {
21+
languageVersion = JavaLanguageVersion.of(17)
22+
}
23+
}
24+
2625
repositories {
2726
mavenCentral()
2827
maven { url "https://repo.grails.org/grails/core" }
@@ -31,9 +30,10 @@ repositories {
3130
dependencies {
3231
implementation "org.springframework.boot:spring-boot-starter-logging"
3332
implementation "org.springframework.boot:spring-boot-autoconfigure"
34-
implementation "org.grails:grails-core"
3533
implementation "org.springframework.boot:spring-boot-starter-actuator"
3634
implementation "org.springframework.boot:spring-boot-starter-tomcat"
35+
implementation "org.grails:grails-core"
36+
3737
implementation "org.grails:grails-web-boot"
3838
implementation "org.grails:grails-logging"
3939
implementation "org.grails:grails-plugin-rest"
@@ -43,42 +43,35 @@ dependencies {
4343
implementation "org.grails:grails-plugin-url-mappings"
4444
implementation "org.grails:grails-plugin-interceptors"
4545

46-
implementation "org.grails.plugins:cache:5.0.1"
47-
implementation "org.grails.plugins:async"
48-
implementation "org.grails.plugins:scaffolding"
49-
implementation "org.grails.plugins:events"
50-
implementation "org.grails.plugins:hibernate5"
51-
implementation "org.hibernate:hibernate-core:5.4.18.Final"
46+
implementation "org.grails.plugins:cache:$cacheVersion"
47+
implementation "org.grails.plugins:async:$asyncVersion"
48+
implementation "org.grails.plugins:hibernate5:$gormVersion"
49+
implementation "org.hibernate:hibernate-core-jakarta:$hibernate5Version"
5250
implementation project(':grails-redis')
5351
implementation "org.grails.plugins:gsp"
5452
console "org.grails:grails-console"
5553
profile "org.grails.profiles:web"
5654

57-
runtimeOnly "org.glassfish.web:el-impl:2.1.2-b03"
58-
runtimeOnly "com.h2database:h2"
55+
runtimeOnly "org.glassfish.expressly:expressly:$expresslyVersion"
56+
runtimeOnly "com.h2database:h2:$h2Version"
5957
runtimeOnly "org.apache.tomcat:tomcat-jdbc"
60-
runtimeOnly "javax.xml.bind:jaxb-api:2.3.1"
61-
runtimeOnly "com.bertramlabs.plugins:asset-pipeline-grails:4.3.0"
62-
58+
runtimeOnly "jakarta.xml.bind:jakarta.xml.bind-api:$xmlBindApiVersion"
59+
runtimeOnly "com.bertramlabs.plugins:asset-pipeline-grails:$assetPipelineGrailVersion"
6360

6461
testImplementation "org.grails:grails-gorm-testing-support"
6562
testImplementation "org.mockito:mockito-core"
6663
testImplementation "org.grails:grails-web-testing-support"
6764
}
6865

69-
bootRun {
70-
ignoreExitValue true
71-
jvmArgs(
72-
'-Dspring.output.ansi.enabled=always',
73-
'-noverify',
74-
'-XX:TieredStopAtLevel=1',
75-
'-Xmx1024m')
76-
sourceResources sourceSets.main
77-
String springProfilesActive = 'spring.profiles.active'
78-
systemProperty springProfilesActive, System.getProperty(springProfilesActive)
66+
application {
67+
mainClass.set("com.example.Application")
7968
}
8069

8170
assets {
8271
minifyJs = true
8372
minifyCss = true
8473
}
74+
75+
test {
76+
useJUnitPlatform()
77+
}

examples/redis-demo/grails-app/conf/application.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,21 +87,22 @@ dataSource:
8787
jmxExport: true
8888
driverClassName: org.h2.Driver
8989
username: sa
90-
password:
90+
password: ''
91+
dialect: org.hibernate.dialect.H2Dialect
9192

9293
environments:
9394
development:
9495
dataSource:
95-
dbCreate: create-drop
96-
url: jdbc:h2:mem:devDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
96+
dbCreate: create-drop
97+
url: jdbc:h2:mem:devDb;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
9798
test:
9899
dataSource:
99100
dbCreate: update
100-
url: jdbc:h2:mem:testDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
101+
url: jdbc:h2:mem:testDb;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
101102
production:
102103
dataSource:
103104
dbCreate: update
104-
url: jdbc:h2:prodDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
105+
url: jdbc:h2:prodDb;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
105106
properties:
106107
jmxEnabled: true
107108
initialSize: 5
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<configuration>
3+
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
4+
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
5+
<charset>UTF-8</charset>
6+
<pattern>%level %logger - %msg%n</pattern>
7+
</encoder>
8+
</appender>
9+
10+
<root level="error">
11+
<appender-ref ref="STDOUT" />
12+
</root>
13+
</configuration>

examples/redis-demo/grails-app/conf/logback.groovy

Lines changed: 0 additions & 28 deletions
This file was deleted.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.example
2+
3+
class IndexController {
4+
5+
BookCreateService bookCreateService
6+
7+
def index() {
8+
render view: "/index", model: [book:bookCreateService.createOrGetBook()]
9+
}
10+
11+
}

0 commit comments

Comments
 (0)