Skip to content

Revert to Sitemesh 2 for Grails 7 #14875

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

Merged
merged 1 commit into from
Jul 6, 2025
Merged
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
7 changes: 7 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -263,4 +263,11 @@ This product includes the following files from Spring Framework 5.3, developed b

See the above Apache License 2.0 for the terms governing these files.

--------------------------------------------------------------------------

This product includes software developed by the OpenSymphony Group (http://www.opensymphony.com/). It uses Sitemesh2,
licensed under the OpenSymphony Software License, Version 1.1.

See licenses/LICENSE-opensymphony.txt for the full license terms.

--------------------------------------------------------------------------
5 changes: 4 additions & 1 deletion NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,7 @@ http://www.oracle.com/webfolder/technetwork/jsc/xml/ns/javaee/index.html

This product includes software from Spring Framework 5.3, developed by Pivotal Software, Inc.
Copyright 2002-2020 the original author or authors.
See the LICENSE file for the Apache License 2.0 terms.
See the LICENSE file for the Apache License 2.0 terms.

This product includes software developed by the OpenSymphony Group (http://www.opensymphony.com/). It uses Sitemesh2,
licensed under the OpenSymphony Software License, Version 1.1. See licenses/LICENSE-opensymphony.txt for the full license terms.
2 changes: 1 addition & 1 deletion RENAME.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ Below is a reference of all migrated artifacts - both their old and new name.
| org.grails.plugins | scaffolding | org.apache.grails | grails-scaffolding | | | grails-views |
| org.grails | grails-plugin-services | org.apache.grails | grails-services | | | grails-core |
| org.grails | grails-shell | org.apache.grails | grails-shell-cli | | | grails-core |
| org.grails | grails-plugin-sitemesh3 | org.apache.grails | grails-sitemesh3 | | | grails-views |
| org.grails.plugins | sitemesh2 | org.apache.grails | grails-layout | | | grails-gsp |
| org.grails | grails-spring | org.apache.grails | grails-spring | | | grails-core |
| org.grails.plugins | spring-security-acl | org.apache.grails | grails-spring-security-acl | | | grails-spring-security |
| org.grails.plugins | spring-security-cas | org.apache.grails | grails-spring-security-cas | | | grails-spring-security |
Expand Down
3 changes: 1 addition & 2 deletions UPGRADE7.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,5 @@ Experienced while upgrading modules for Grails 7

### Cool New Features
- Hello Exterminator, Good by bugs! Lot's of things started working... and working well! For instance, use of controller namespaces now work seemlessly.
- Massive decoupling of dependencies and cleanup between modules. SiteMesh dependencies are no longer compiled into controllers fused between numerous modules. SiteMesh isn't even required to use Grails!
- GSP can now be used OUTSIDE of Grails! see grails-boot
- Massive decoupling of dependencies and cleanup between modules.
- Works with Spring Security 6 out of the box. No plugin needed!
2 changes: 2 additions & 0 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ ext {
'rxjava3.version' : '3.1.10',
'selenium.version' : '4.25.0',
'spock.version' : '2.3-groovy-4.0',
'sitemesh.version' : '2.6.0',
]

// Note: the name of the dependency must be the prefix of the property name so properties in the pom are resolved correctly
Expand Down Expand Up @@ -123,6 +124,7 @@ ext {
'rxjava' : "io.reactivex:rxjava:${bomDependencyVersions['rxjava.version']}",
'rxjava2' : "io.reactivex.rxjava2:rxjava:${bomDependencyVersions['rxjava2.version']}",
'rxjava3' : "io.reactivex.rxjava3:rxjava:${bomDependencyVersions['rxjava3.version']}",
'sitemesh' : "opensymphony:sitemesh:${bomDependencyVersions['sitemesh.version']}",
]

// Because pom exclusions aren't properly supported by gradle, we can't inherit the grails-gradle-bom
Expand Down
8 changes: 6 additions & 2 deletions etc/bin/rename_gradle_artifacts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,9 @@ declare -a views_mappings=(
"org[.]grails:grails-web-gsp-taglib|org.apache.grails.views:grails-web-gsp-taglib"
"org[.]grails:grails-web-gsp|org.apache.grails.views:grails-web-gsp"
"org[.]grails:grails-taglib|org.apache.grails.views:grails-taglib"
"org[.]grails:grails-plugin-sitemesh3|org.apache.grails:grails-sitemesh3"
#"org[.]grails:grails-plugin-sitemesh3|org.apache.grails:grails-sitemesh3"
"org[.]grails[.].plugins:sitemesh2|org.apache.grails:grails-layout"
"org[.]grails:grails-web-sitemesh|org.apache.grails:grails-web-layout"
"org[.]grails:grails-gsp|org.apache.grails.views:grails-gsp-core"
)
declare -a excluded_gsp_mappings=(
Expand All @@ -171,7 +173,9 @@ declare -a views_mappings=(
"exclude[[:space:]]+module[[:space:]]*:[[:space:]]*['\"]scaffolding['\"]|exclude module:'grails-scaffolding'"
"exclude[[:space:]]+module[[:space:]]*:[[:space:]]*['\"]gsp['\"]|exclude module:'grails-gsp'"
"exclude[[:space:]]+module[[:space:]]*:[[:space:]]*['\"]grails-web-testing-support['\"]|exclude module:'grails-testing-support-web'"
"exclude[[:space:]]+module[[:space:]]*:[[:space:]]*['\"]grails-plugin-sitemesh3['\"]|exclude module:'grails-sitemesh3'"
#"exclude[[:space:]]+module[[:space:]]*:[[:space:]]*['\"]grails-plugin-sitemesh3['\"]|exclude module:'grails-sitemesh3'"
"exclude[[:space:]]+module[[:space:]]*:[[:space:]]*['\"]sitemesh2['\"]|exclude module:'grails-layout'"
"exclude[[:space:]]+module[[:space:]]*:[[:space:]]*['\"]grails-web-sitemesh['\"]|exclude module:'grails-web-layout'"
"exclude[[:space:]]+module[[:space:]]*:[[:space:]]*['\"]grails-gsp['\"]|exclude module:'grails-gsp-core'"
"exclude[[:space:]]+module[[:space:]]*:[[:space:]]*['\"]fields['\"]|exclude module:'grails-fields'"
)
Expand Down
1 change: 0 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ joddWotVersion=3.3.8
elApiVersion=5.0.1
defaultElImplementationVersion=5.0.0
jspApiVersion=4.0.0
sitemeshVersion=3.2.2
javassistVersion=3.30.2-GA
yakworksHibernateGroovyProxyVersion=1.1
picocliVersion=4.7.6
Expand Down
3 changes: 2 additions & 1 deletion gradle/publish-root-config.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def publishedProjects = [
'grails-scaffolding',
'grails-services',
'grails-shell-cli',
'grails-sitemesh3',
'grails-layout',
'grails-spring',
'grails-taglib',
'grails-test-core',
Expand All @@ -87,6 +87,7 @@ def publishedProjects = [
'grails-web-gsp',
'grails-web-gsp-taglib',
'grails-web-jsp',
'grails-web-layout',
'grails-web-mvc',
'grails-web-taglib',
'grails-web-url-mappings',
Expand Down
1 change: 1 addition & 0 deletions grails-controllers/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ dependencies {
api project(':grails-mimetypes')
api project(':grails-validation')
api project(':grails-domain-class')
api project(':grails-web-layout')

api 'org.apache.groovy:groovy'
api 'org.springframework.boot:spring-boot-autoconfigure'
Expand Down
2 changes: 1 addition & 1 deletion grails-doc/src/en/guide/conf/config/builtInOptions.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ On the runtime front, i.e. `grails-app/conf/application.yml`, there are quite a
* `grails.mime.file.extensions` - Whether to use the file extension to dictate the mime type in link:theWebLayer.html#contentNegotiation[Content Negotiation] (default: true).
* `grails.mime.types` - A map of supported mime types used for link:theWebLayer.html#contentNegotiation[Content Negotiation].
* `grails.serverURL` - A string specifying the server URL portion of absolute links, including server name e.g. grails.serverURL="http://my.yourportal.com". See link:{gspdocs}/ref/Tags/createLink.html[createLink]. Also used by redirects.
* `grails.views.gsp.sitemesh.preprocess` - Determines whether SiteMesh preprocessing happens. Disabling this slows down page rendering, but if you need SiteMesh to parse the generated HTML from a GSP view then disabling it is the right option. Don't worry if you don't understand this advanced property: leave it set to true.
* `grails.views.gsp.layout.preprocess` - Determines whether layout preprocessing happens. Disabling this slows down page rendering, but if you need Grails' layout implementation to parse the generated HTML from a GSP view, then disabling it is the right option. Don't worry if you don't understand this advanced property: leave it set to true.
* `grails.reload.excludes` and `grails.reload.includes` - Configuring these directives determines the reload behavior for project specific source files. Each directive takes a list of strings that are the class names for project source files that should be excluded from reloading behavior or included accordingly when running the application in development with the `bootRun` task. If the `grails.reload.includes` directive is configured, then only the classes in that list will be reloaded.

9 changes: 4 additions & 5 deletions grails-doc/src/en/guide/theWebLayer/gsp/layouts.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ under the License.

==== Creating Layouts


Grails leverages https://github.com/sitemesh[Sitemesh], a decorator engine, to support view layouts. Layouts are located in the `grails-app/views/layouts` directory. A typical layout can be seen below:
This product includes software developed by the OpenSymphony Group (http://www.opensymphony.com/). The Sitemesh framework is used to provide a decorator engine, to support view layouts. Layouts are located in the `grails-app/views/layouts` directory. A typical layout can be seen below:

[source,xml]
----
Expand Down Expand Up @@ -129,13 +128,13 @@ Alternatively, you can create a layout called `grails-app/views/layouts/book/lis
If you have both the above-mentioned layouts in place the layout specific to the action will take precedence when the list action is executed.

If a layout is not located using any of those conventions, the convention of last resort is to look for the application default layout which
is `grails-app/views/layouts/application.gsp`. The name of the application default layout may be changed by defining the property `grails.sitemesh.default.layout`
is `grails-app/views/layouts/application.gsp`. The name of the application default layout may be changed by defining the property `grails.views.layout.default`
in the application configuration as follows:

[source,yaml]
.grails-app/conf/application.yml
----
grails.sitemesh.default.layout: myLayoutName
grails.views.layout.default: myLayoutName
----

With that property in place, the application default layout will be `grails-app/views/layouts/myLayoutName.gsp`.
Expand All @@ -144,7 +143,7 @@ With that property in place, the application default layout will be `grails-app/
==== Inline Layouts


Grails' also supports Sitemesh's concept of inline layouts with the xref:../../../ref/Tags%20-%20GSP/applyLayout.adoc[applyLayout] tag. This can be used to apply a layout to a template, URL or arbitrary section of content. This lets you even further modularize your view structure by "decorating" your template includes.
Grails also supports inline layouts with the xref:../../../ref/Tags%20-%20GSP/applyLayout.adoc[applyLayout] tag. This can be used to apply a layout to a template, URL or arbitrary section of content. This lets you even further modularize your view structure by "decorating" your template includes.

Some examples of usage can be seen below:

Expand Down
21 changes: 21 additions & 0 deletions grails-doc/src/en/guide/upgrading/upgrading60x.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,27 @@ As part of any major release, APIs can change. For Grails 7.0, the list of rena

* GrailsClassUtils#isMatchBetweenPrimativeAndWrapperTypes -> GrailsClassUtils#isMatchBetweenPrimitiveAndWrapperTypes

====== 12.13 Layout Configuration

There are several changes related to layout related configuration:

Package Changes:
* grails.web.sitemesh -> org.apache.grails.web.layout
* org.grails.web.sitemesh -> org.apache.grails.views.gsp.layout

Notable Class Moves:
* org.grails.web.servlet.view.GrailsLayoutViewResolver -> org.grails.web.servlet.view.EmbeddedGrailsLayoutViewResolver
* org.grails.web.servlet.view.SitemeshLayoutViewResolver -> org.grails.web.servlet.view.GrailsLayoutViewResolver
* org.grails.web.sitemesh.GrailsLayoutView -> org.apache.grails.web.layout.EmbeddedGrailsLayoutView
* org.grails.web.sitemesh.SitemeshLayoutView -> org.apache.grails.web.layout.GrailsLayoutView

Property Changes:
* grails.sitemesh.default.layout -> grails.views.layout.default
* grails.sitemesh.enable.nongsp -> grails.views.layout.enable.nongsp

Tag namespace changes:
* sitemesh -> grailsLayout

====== Key Features

By extending your test classes with `ContainerGebSpec`, your tests will automatically leverage a containerized browser provided by https://www.testcontainers.org[Testcontainers]. This setup eliminates the need for managing browser versions and ensures consistent test environments.
Expand Down
2 changes: 1 addition & 1 deletion grails-doc/src/en/ref/Tags - GSP/layoutHead.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ under the License.
=== Purpose


Used in layouts to render the contents of the head tag of the decorated page. Equivalent to the SiteMesh `<decorator:head />` tag.
Used in layouts to render the contents of the head tag of the decorated page.


=== Examples
Expand Down
2 changes: 1 addition & 1 deletion grails-doc/src/en/ref/Tags - GSP/layoutTitle.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ under the License.
=== Purpose


Used in layouts to render the contents of the title tag of the decorated page. Equivalent to the SiteMesh `<decorator:title />` tag.
Used in layouts to render the contents of the title tag of the decorated page.


=== Examples
Expand Down
2 changes: 1 addition & 1 deletion grails-doc/src/en/ref/Tags - GSP/pageProperty.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ under the License.
=== Purpose


Used in layouts to output the contents a property of the decorated page. Equivalent to the SiteMesh `<decorator:getProperty/>` tag.
Used in layouts to output the contents a property of the decorated page.


=== Examples
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3679,7 +3679,7 @@ <h3 id="_runtime_settings">Runtime settings</h3>
<p><code>grails.serverURL</code> - A string specifying the server URL portion of absolute links, including server name e.g. grails.serverURL="http://my.yourportal.com". See <a href="../ref/Tags/createLink.html">createLink</a>. Also used by redirects.</p>
</li>
<li>
<p><code>grails.views.gsp.sitemesh.preprocess</code> - Determines whether SiteMesh preprocessing happens. Disabling this slows down page rendering, but if you need SiteMesh to parse the generated HTML from a GSP view then disabling it is the right option. Don&#8217;t worry if you don&#8217;t understand this advanced property: leave it set to true.</p>
<p><code>grails.views.gsp.layout.preprocess</code> - Determines whether Layout preprocessing happens. Disabling this slows down page rendering, but if you need layouts to parse the generated HTML from a GSP view then disabling it is the right option. Don&#8217;t worry if you don&#8217;t understand this advanced property: leave it set to true.</p>
</li>
<li>
<p><code>grails.reload.excludes</code> and <code>grails.reload.includes</code> - Configuring these directives determines the reload behavior for project specific source files. Each directive takes a list of strings that are the class names for project source files that should be excluded from reloading behavior or included accordingly when running the application in development with the <code>run-app</code> command. If the <code>grails.reload.includes</code> directive is configured, then only the classes in that list will be reloaded.</p>
Expand Down Expand Up @@ -10374,7 +10374,7 @@ <h4 id="_layout_by_convention">Layout by Convention</h4>
</div>
<div class="listingblock">
<div class="content">
<pre class="CodeRay highlight"><code data-lang="groovy">grails.sitemesh.default.layout = <span class="string"><span class="delimiter">'</span><span class="content">myLayoutName</span><span class="delimiter">'</span></span></code></pre>
<pre class="CodeRay highlight"><code data-lang="groovy">grails.views.layout.default = <span class="string"><span class="delimiter">'</span><span class="content">myLayoutName</span><span class="delimiter">'</span></span></code></pre>
</div>
</div>
<div class="paragraph">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ <h2 id="_layouthead">layoutHead</h2>
<div class="sect2">
<h3 id="_purpose">Purpose</h3>
<div class="paragraph">
<p>Used in layouts to render the contents of the head tag of the decorated page. Equivalent to the SiteMesh <code>&lt;decorator:head /&gt;</code> tag.</p>
<p>Used in layouts to render the contents of the head tag of the decorated page.
</div>
</div>
<div class="sect2">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ <h2 id="_layouttitle">layoutTitle</h2>
<div class="sect2">
<h3 id="_purpose">Purpose</h3>
<div class="paragraph">
<p>Used in layouts to render the contents of the title tag of the decorated page. Equivalent to the SiteMesh <code>&lt;decorator:title /&gt;</code> tag.</p>
<p>Used in layouts to render the contents of the title tag of the decorated page.
</div>
</div>
<div class="sect2">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ <h2 id="_pageproperty">pageProperty</h2>
<div class="sect2">
<h3 id="_purpose">Purpose</h3>
<div class="paragraph">
<p>Used in layouts to output the contents of a property of the decorated page. Equivalent to the SiteMesh <code>&lt;decorator:getProperty/&gt;</code> tag.</p>
<p>Used in layouts to output the contents of a property of the decorated page.
</div>
</div>
<div class="sect2">
Expand Down
Loading
Loading