Skip to content

Commit

Permalink
Grails 7
Browse files Browse the repository at this point in the history
  • Loading branch information
codeconsole committed Nov 12, 2024
1 parent 4c4dc29 commit 9e0e01e
Show file tree
Hide file tree
Showing 13 changed files with 39 additions and 60 deletions.
2 changes: 1 addition & 1 deletion .sdkmanrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
java=11.0.24-librca
java=17.0.12-librca
8 changes: 1 addition & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,5 @@ plugins {
allprojects {
group = 'org.grails'

compileJava.options.release = 11

repositories {
mavenLocal()
mavenCentral()
maven { url "https://repo.grails.org/grails/core/" }
}
compileJava.options.release = 17
}
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version=6.2.2-SNAPSHOT
grailsVersion=6.2.2-SNAPSHOT
version=7.0.0-SNAPSHOT
grailsVersion=7.0.0-SNAPSHOT
10 changes: 7 additions & 3 deletions grails-gsp-spring-boot/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ buildscript {
maven { url = 'https://repo.grails.org/grails/core' }
}
dependencies {
classpath "org.grails:grails-gradle-plugin:6.2.2-SNAPSHOT"
classpath "org.grails:grails-gradle-plugin:7.0.0-SNAPSHOT"
}
}

Expand All @@ -14,9 +14,13 @@ plugins {
apply plugin: 'org.grails.grails-plugin'
apply plugin: "org.grails.internal.grails-plugin-publish"

repositories {
mavenCentral()
maven { url "https://repo.grails.org/grails/core/" }
}

dependencies {
api "org.sitemesh:grails-plugin-sitemesh3:6.2.0"
compileOnly "javax.servlet.jsp:javax.servlet.jsp-api:2.3.3"
api "org.sitemesh:grails-plugin-sitemesh3:7.0.0-SNAPSHOT"
}

grailsPublish {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@
import org.grails.encoder.CodecLookup;
import org.grails.gsp.GroovyPagesTemplateEngine;
import org.grails.gsp.io.GroovyPageScriptSource;
import org.grails.gsp.jsp.TagLibraryResolver;
import org.grails.plugins.web.taglib.RenderSitemeshTagLib;
import org.grails.taglib.TagLibraryLookup;
import org.grails.web.gsp.GroovyPagesTemplateRenderer;
import org.grails.web.pages.StandaloneTagLibraryLookup;
import org.grails.web.gsp.io.CachingGrailsConventionGroovyPageLocator;
import org.grails.web.gsp.io.GrailsConventionGroovyPageLocator;
import org.grails.gsp.jsp.TagLibraryResolverImpl;
import org.grails.web.servlet.view.GrailsLayoutViewResolver;
import org.grails.web.servlet.view.GroovyPageViewResolver;
import org.grails.web.sitemesh.GroovyPageLayoutFinder;
import org.sitemesh.autoconfigure.SiteMeshAutoConfiguration;
import org.sitemesh.grails.plugins.sitemesh3.GrailsLayoutHandlerMapping;
import org.sitemesh.grails.plugins.sitemesh3.Sitemesh3GrailsPlugin;
Expand Down Expand Up @@ -69,7 +69,7 @@
import org.grails.plugins.web.taglib.SitemeshTagLib;
import org.grails.plugins.web.taglib.RenderTagLib;

import javax.servlet.ServletContext;
import jakarta.servlet.ServletContext;

@Configuration
@AutoConfigureAfter(WebMvcAutoConfiguration.class)
Expand Down Expand Up @@ -111,15 +111,17 @@ protected static class GspTemplateEngineAutoConfiguration extends AbstractGspCon
@Value("${sitemesh.decorator.default:}")
String defaultLayoutName;

@Bean(autowire=Autowire.BY_NAME)
@Bean
@ConditionalOnMissingBean(name="groovyPagesTemplateEngine")
GroovyPagesTemplateEngine groovyPagesTemplateEngine() {
GroovyPagesTemplateEngine groovyPagesTemplateEngine(TagLibraryResolver tagLibraryResolver, TagLibraryLookup tagLibraryLookup) {
GroovyPagesTemplateEngine templateEngine = new GroovyPagesTemplateEngine();
templateEngine.setReloadEnabled(gspReloadingEnabled);
templateEngine.setJspTagLibraryResolver(tagLibraryResolver);
templateEngine.setTagLibraryLookup(tagLibraryLookup);
return templateEngine;
}

@Bean(autowire=Autowire.BY_NAME)
@Bean
@ConditionalOnMissingBean(name="groovyPageLocator")
GrailsConventionGroovyPageLocator groovyPageLocator() {
final List<String> templateRootsCleaned=resolveTemplateRoots();
Expand Down Expand Up @@ -175,17 +177,6 @@ protected List<String> resolveTemplateRoots() {
}

@Bean
@ConditionalOnMissingBean(name = "groovyPageLayoutFinder")
public GroovyPageLayoutFinder groovyPageLayoutFinder() {
GroovyPageLayoutFinder groovyPageLayoutFinder = new GroovyPageLayoutFinder();
groovyPageLayoutFinder.setGspReloadEnabled(gspReloadingEnabled);
groovyPageLayoutFinder.setCacheEnabled(gspLayoutCaching);
groovyPageLayoutFinder.setEnableNonGspViews(false);
groovyPageLayoutFinder.setDefaultDecoratorName(defaultLayoutName);
return groovyPageLayoutFinder;
}

@Bean(autowire=Autowire.BY_NAME)
@ConditionalOnMissingBean(name = "groovyPagesTemplateRenderer")
GroovyPagesTemplateRenderer groovyPagesTemplateRenderer() {
GroovyPagesTemplateRenderer groovyPagesTemplateRenderer = new GroovyPagesTemplateRenderer();
Expand Down Expand Up @@ -217,16 +208,12 @@ public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)
protected static class GspViewResolverConfiguration extends AbstractGspConfig {
@Bean
@ConditionalOnMissingBean(name = "gspViewResolver")
public ViewResolver gspViewResolver(GroovyPagesTemplateEngine groovyPagesTemplateEngine, GrailsConventionGroovyPageLocator groovyPageLocator, GroovyPageLayoutFinder groovyPageLayoutFinder) {
public ViewResolver gspViewResolver(GroovyPagesTemplateEngine groovyPagesTemplateEngine, GrailsConventionGroovyPageLocator groovyPageLocator) {
GroovyPageViewResolver groovyPageViewResolver = new GroovyPageViewResolver(groovyPagesTemplateEngine, groovyPageLocator);
groovyPageViewResolver.setResolveJspView(jspEnabled);
groovyPageViewResolver.setAllowGrailsViewCaching(!gspReloadingEnabled || viewCacheTimeout != 0);
groovyPageViewResolver.setCacheTimeout(gspReloadingEnabled ? viewCacheTimeout : -1);
if (!sitemesh3) {
return new GrailsLayoutViewResolver(groovyPageViewResolver, groovyPageLayoutFinder);
} else {
return groovyPageViewResolver;
}
return groovyPageViewResolver;
}
}

Expand Down Expand Up @@ -317,10 +304,10 @@ public void setEnvironment(Environment environment) {
}
}

@ConditionalOnClass({javax.servlet.jsp.tagext.JspTag.class, TagLibraryResolverImpl.class})
@ConditionalOnClass({TagLibraryResolverImpl.class})
@Configuration
protected static class GspJspIntegrationConfiguration implements EnvironmentAware {
@Bean(autowire = Autowire.BY_NAME)
@Bean
public TagLibraryResolverImpl jspTagLibraryResolver() {
return new TagLibraryResolverImpl();
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
grails.gsp.boot.GspAutoConfiguration
17 changes: 7 additions & 10 deletions sample-apps/gsp/gsp-example/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,21 @@ buildscript {
maven { url "https://repo.grails.org/grails/core/" }
}
dependencies {
classpath "org.grails:grails-gradle-plugin:6.2.2-SNAPSHOT"
classpath "org.grails:grails-gradle-plugin:7.0.0-SNAPSHOT"
}
}

plugins {
id 'java'
id 'war'
id 'org.springframework.boot' version "2.7.18"
id 'io.spring.dependency-management' version '1.0.15.RELEASE'
id 'org.springframework.boot' version "3.3.5"
id 'io.spring.dependency-management' version '1.1.6'
id "groovy"
}

apply plugin: "org.grails.grails-gsp"

repositories {
mavenLocal()
mavenCentral()
maven { url "https://repo.grails.org/grails/core/" }
}
Expand All @@ -34,13 +33,11 @@ compileGroovyPages {
dependencies {
implementation project(':grails-gsp-spring-boot')

implementation("org.springframework.boot:spring-boot-starter-web:2.7.18")
implementation "org.hibernate.validator:hibernate-validator:8.0.0.Final" // validation

implementation("org.hibernate:hibernate-validator:6.0.10.Final") // validation
implementation "org.grails:grails-web-jsp:7.0.0-SNAPSHOT"
implementation "org.grails:grails-plugin-controllers:7.0.0-SNAPSHOT" // only needed for GrailsFilters

implementation("org.grails:grails-web-jsp:6.2.2-SNAPSHOT")
implementation("javax.servlet.jsp:javax.servlet.jsp-api:2.3.3")
implementation("javax.servlet.jsp.jstl:javax.servlet.jsp.jstl-api:1.2.2")
implementation 'org.apache.tomcat.embed:tomcat-embed-jasper' // jsp
implementation("org.apache.tomcat.embed:tomcat-embed-el")
implementation "org.apache.tomcat.embed:tomcat-embed-el"
}
6 changes: 3 additions & 3 deletions sample-apps/gsp/gsp-example/src/main/java/hello/Person.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package hello;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;

public class Person {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package hello;

import jakarta.servlet.http.HttpSession;
import jakarta.validation.Valid;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
Expand All @@ -8,9 +10,6 @@
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.servlet.http.HttpSession;
import javax.validation.Valid;

@Controller
public class WebController implements WebMvcConfigurer {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
grails.gsp.tldScanPattern=classpath*:/META-INF/spring*.tld
spring.main.allow-circular-references=true
logging.level.web=trace
grails.views.gsp.sitemesh.preprocess=false
sitemesh.decorator.default=main
4 changes: 2 additions & 2 deletions sample-apps/gsp/script/.sdkmanrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
java=11.0.24-librca
springboot=2.7.18
java=17.0.12-librca
springboot=3.3.5
2 changes: 1 addition & 1 deletion sample-apps/gsp/script/app.groovy
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@GrabResolver(name='grails-repo', root='https://repo.grails.org/grails/core/')
@Grab("org.grails:grails-gsp-spring-boot:6.2.2-SNAPSHOT")
@Grab("org.grails:grails-gsp-spring-boot:7.0.0-SNAPSHOT")

import grails.gsp.TagLib
import org.springframework.web.servlet.ModelAndView
Expand Down

0 comments on commit 9e0e01e

Please sign in to comment.