Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grails-156: Update to Grails 7, JDK17, Groovy 4 #157

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ jobs:
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: 11
distribution: 'liberica'
java-version: 17
- name: Setup Redis
uses: supercharge/[email protected]
with:
Expand All @@ -42,8 +42,8 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: 11
distribution: 'liberica'
java-version: 17
- name: Publish Artifacts (repo.grails.org)
id: publish
uses: gradle/gradle-build-action@v2
Expand All @@ -70,5 +70,5 @@ jobs:
BRANCH: gh-pages
FOLDER: plugin/build/docs
DOC_FOLDER: gh-pages
COMMIT_EMAIL: [email protected]
COMMIT_NAME: Puneet Behl
COMMIT_EMAIL: '[email protected]'
COMMIT_NAME: 'grails-build'
12 changes: 6 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ jobs:
release:
runs-on: ubuntu-latest
env:
GIT_USER_NAME: puneetbehl
GIT_USER_EMAIL: [email protected]
GIT_USER_NAME: 'grails-build'
GIT_USER_EMAIL: '[email protected]'
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -16,8 +16,8 @@ jobs:
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: '11'
distribution: 'liberica'
java-version: '17'
- name: Set the current release version
id: release_version
run: echo ::set-output name=release_version::${GITHUB_REF:11}
Expand Down Expand Up @@ -60,8 +60,8 @@ jobs:
BRANCH: gh-pages
FOLDER: plugin/build/docs
DOC_FOLDER: gh-pages
COMMIT_EMAIL: [email protected]
COMMIT_NAME: Puneet Behl
COMMIT_EMAIL: ${{ env.GIT_USER_EMAIL }}
COMMIT_NAME: ${{ env.GIT_USER_NAME }}
VERSION: ${{ steps.release_version.outputs.release_version }}
- name: Run post-release
if: success()
Expand Down
57 changes: 34 additions & 23 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,20 +1,32 @@

plugins {
id 'io.github.gradle-nexus.publish-plugin' version '1.3.0'
id "java-library"
id "org.grails.internal.grails-plugin-publish"
id "org.grails.grails-gsp"
id "org.grails.grails-plugin"
}

ext.isSnapshot = project.projectVersion.endsWith('-SNAPSHOT')
ext.isReleaseVersion = !isSnapshot
ext."signing.keyId" = project.hasProperty("signing.keyId") ? project.getProperty('signing.keyId') : System.getenv('SIGNING_KEY')
ext."signing.secretKeyRingFile" = project.hasProperty("signing.secretKeyRingFile") ? project.getProperty('signing.secretKeyRingFile') : "${System.properties['user.home']}${File.separator}.gnupg${File.separator}secring.gpg"
ext."signing.password" = project.hasProperty("signing.password") ? project.getProperty('signing.password') : System.getenv('SIGNING_PASSPHRASE')

version = project.projectVersion
group = 'org.grails.plugins'

allprojects {

repositories {
mavenCentral()
maven { url "https://repo.grails.org/grails/core" }
maven {
url = 'https://repo.gradle.org/gradle/libs-releases'
description = 'Needed for Gradle Tooling API'
}
}

configurations.configureEach {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if ((details.requested.group == 'org.codehaus.groovy' || details.requested.group == 'org.apache.groovy') && details.requested.name != 'groovy-bom') {
details.useTarget(group: 'org.apache.groovy', name: details.requested.name, version: "$groovyVersion")
details.because "The dependency coordinates are changed in Apache Groovy 4, plus ensure version"
}
}
}

tasks.withType(GroovyCompile) {
Expand All @@ -24,21 +36,20 @@ allprojects {
}
}

if (isReleaseVersion) {
apply plugin: "io.github.gradle-nexus.publish-plugin"

nexusPublishing {
repositories {
sonatype {
def ossUser = System.getenv("SONATYPE_USERNAME") ?: project.hasProperty("sonatypeOssUsername") ? project.sonatypeOssUsername : ''
def ossPass = System.getenv("SONATYPE_PASSWORD") ?: project.hasProperty("sonatypeOssPassword") ? project.sonatypeOssPassword : ''
def ossStagingProfileId = System.getenv("SONATYPE_STAGING_PROFILE_ID") ?: project.hasProperty("sonatypeOssStagingProfileId") ? project.sonatypeOssStagingProfileId : ''
nexusUrl = uri("https://s01.oss.sonatype.org/service/local/")
snapshotRepositoryUrl = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
username = ossUser
password = ossPass
stagingProfileId = ossStagingProfileId
}
}
dependencyManagement {
imports {
mavenBom "org.grails:grails-bom:$grailsVersion"
}
applyMavenExclusions false
}

grailsPublish {
userOrg = 'grails'
githubSlug = 'grails/redis'
license {
name = 'Apache-2.0'
}
title = 'Grails Redis Plugin'
desc = 'This Plugin provides access to Redis and various utilities(service, annotations, etc) for caching.'
developers = [puneetbehl: 'Puneet Behl']
}
10 changes: 10 additions & 0 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apply from: "./loadProps.gradle"

repositories {
mavenCentral()
maven { url "https://repo.grails.org/grails/core" }
}
dependencies {
implementation "com.bertramlabs.plugins:asset-pipeline-gradle:${assetPipelineGrailVersion}"
implementation "org.grails:grails-gradle-plugin:${grailsVersion}"
}
8 changes: 8 additions & 0 deletions buildSrc/loadProps.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Properties properties = new Properties()
FileInputStream input = new FileInputStream(file("${rootDir.parentFile}/gradle.properties"))
properties.load(input)
input.close()

for (String key : properties.stringPropertyNames()) {
ext.set(key, properties.getProperty(key))
}
74 changes: 34 additions & 40 deletions examples/redis-demo/build.gradle
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
buildscript {
repositories {
maven { url "https://repo.grails.org/grails/core" }
}
dependencies {
classpath "org.grails:grails-gradle-plugin:$grailsGradlePluginVersion"
classpath "com.bertramlabs.plugins:asset-pipeline-gradle:4.3.0"
}
}

version "0.1"
group "com.example"

apply plugin: "war"
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: "org.grails.grails-web"
apply plugin:"com.bertramlabs.asset-pipeline"
apply plugin: "org.grails.grails-gsp"
plugins {
id "war"
id 'eclipse'
id 'idea'
id "org.grails.grails-web"
id "com.bertramlabs.asset-pipeline"
id "org.grails.grails-gsp"
id "application"
}

version = project.projectVersion
group = "com.example"
assets {
minifyJs = true
minifyCss = true
}

java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}

repositories {
mavenCentral()
maven { url "https://repo.grails.org/grails/core" }
Expand All @@ -31,9 +30,10 @@ repositories {
dependencies {
implementation "org.springframework.boot:spring-boot-starter-logging"
implementation "org.springframework.boot:spring-boot-autoconfigure"
implementation "org.grails:grails-core"
implementation "org.springframework.boot:spring-boot-starter-actuator"
implementation "org.springframework.boot:spring-boot-starter-tomcat"
implementation "org.grails:grails-core"

implementation "org.grails:grails-web-boot"
implementation "org.grails:grails-logging"
implementation "org.grails:grails-plugin-rest"
Expand All @@ -43,42 +43,36 @@ dependencies {
implementation "org.grails:grails-plugin-url-mappings"
implementation "org.grails:grails-plugin-interceptors"

implementation "org.grails.plugins:cache:5.0.1"
implementation "org.grails.plugins:async"
implementation "org.grails.plugins:scaffolding"
implementation "org.grails.plugins:events"
implementation "org.grails.plugins:hibernate5"
implementation "org.hibernate:hibernate-core:5.4.18.Final"
implementation "org.grails.plugins:cache:$cacheVersion"
implementation "org.grails.plugins:async:$asyncVersion"
implementation "org.grails.plugins:hibernate5:$gormVersion"
implementation "org.hibernate:hibernate-core-jakarta:$hibernate5Version"
implementation project(':grails-redis')
implementation "org.grails.plugins:gsp"
console "org.grails:grails-console"
profile "org.grails.profiles:web"

runtimeOnly "org.glassfish.web:el-impl:2.1.2-b03"
runtimeOnly "com.h2database:h2"
runtimeOnly "org.glassfish.expressly:expressly:$expresslyVersion"
runtimeOnly "com.h2database:h2:$h2Version"
runtimeOnly "org.apache.tomcat:tomcat-jdbc"
runtimeOnly "javax.xml.bind:jaxb-api:2.3.1"
runtimeOnly "com.bertramlabs.plugins:asset-pipeline-grails:4.3.0"

runtimeOnly "jakarta.xml.bind:jakarta.xml.bind-api:$xmlBindApiVersion"
runtimeOnly "com.bertramlabs.plugins:asset-pipeline-grails:$assetPipelineGrailVersion"
implementation "org.grails:grails-shell:7.0.0-SNAPSHOT"

testImplementation "org.grails:grails-gorm-testing-support"
testImplementation "org.mockito:mockito-core"
testImplementation "org.grails:grails-web-testing-support"
}

bootRun {
ignoreExitValue true
jvmArgs(
'-Dspring.output.ansi.enabled=always',
'-noverify',
'-XX:TieredStopAtLevel=1',
'-Xmx1024m')
sourceResources sourceSets.main
String springProfilesActive = 'spring.profiles.active'
systemProperty springProfilesActive, System.getProperty(springProfilesActive)
application {
mainClass.set("com.example.Application")
}

assets {
minifyJs = true
minifyCss = true
}

test {
useJUnitPlatform()
}
11 changes: 6 additions & 5 deletions examples/redis-demo/grails-app/conf/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,21 +87,22 @@ dataSource:
jmxExport: true
driverClassName: org.h2.Driver
username: sa
password:
password: ''
dialect: org.hibernate.dialect.H2Dialect

environments:
development:
dataSource:
dbCreate: create-drop
url: jdbc:h2:mem:devDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
dbCreate: create-drop
url: jdbc:h2:mem:devDb;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
test:
dataSource:
dbCreate: update
url: jdbc:h2:mem:testDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
url: jdbc:h2:mem:testDb;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
production:
dataSource:
dbCreate: update
url: jdbc:h2:prodDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
url: jdbc:h2:prodDb;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
properties:
jmxEnabled: true
initialSize: 5
Expand Down
28 changes: 0 additions & 28 deletions examples/redis-demo/grails-app/conf/logback.groovy

This file was deleted.

13 changes: 13 additions & 0 deletions examples/redis-demo/grails-app/conf/logback.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<charset>UTF-8</charset>
<pattern>%level %logger - %msg%n</pattern>
</encoder>
</appender>

<root level="error">
<appender-ref ref="STDOUT" />
</root>
</configuration>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.example

class IndexController {

BookCreateService bookCreateService

def index() {
render view: "/index", model: [book:bookCreateService.createOrGetBook()]
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class UrlMappings {
}
}

"/"(view:"/index")
"/"(controller: "index", action: "index")
"500"(view:'/error')
}
}
Loading
Loading