From 768fb04767430990788600f4b5689a14bdff739b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Berg=20Glasius?= Date: Tue, 11 Nov 2025 16:41:54 +0100 Subject: [PATCH 1/2] [chore] Correct docs with apply and dependencies for gsp and gson --- .../theWebLayer/gson/jsonInstallation.adoc | 17 +++++++++++------ grails-doc/src/en/guide/theWebLayer/gsp.adoc | 2 +- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/grails-doc/src/en/guide/theWebLayer/gson/jsonInstallation.adoc b/grails-doc/src/en/guide/theWebLayer/gson/jsonInstallation.adoc index 2cdca365a00..95b17914bbb 100644 --- a/grails-doc/src/en/guide/theWebLayer/gson/jsonInstallation.adoc +++ b/grails-doc/src/en/guide/theWebLayer/gson/jsonInstallation.adoc @@ -17,10 +17,15 @@ specific language governing permissions and limitations under the License. //// -To activate JSON views, add the following dependency to the `dependencies` block of your `build.gradle`: +To activate JSON views, add the following dependency to the `dependencies` block of your `build.gradle`, if you use the Grails BOM: + +[source,groovy] +implementation "org.apache.grails:grails-views-gson" + +otherwise add version information [source,groovy,subs="attributes"] -compile "org.apache.grails:grails-views-gson:{version}" +implementation "org.apache.grails:grails-views-gson:{version}" To enable Gradle compilation of JSON views for production environment add the following to the `buildscript` `dependencies` block: @@ -29,16 +34,16 @@ buildscript { ... dependencies { ... - classpath "org.apache.grails:grails-gradle-bom:{version}" + classpath platform("org.apache.grails:grails-gradle-bom:{version}") classpath "org.apache.grails:grails-gradle-plugins" } } -Then apply the `org.apache.grails.grails-views-gson` Gradle plugin after any Grails core gradle plugins: +Then apply the `org.apache.grails.gradle.grails-gson` Gradle plugin after any Grails core gradle plugins: [source,groovy] ... -apply plugin: "org.apache.grails:grails-web" -apply plugin: "org.apache.grails.grails-views-gson" +apply plugin: "org.apache.grails.gradle.grails-web" +apply plugin: "org.apache.grails.gradle.grails-gson" This will add a `compileGsonViews` task to Gradle that is executed when producing a JAR or WAR file. diff --git a/grails-doc/src/en/guide/theWebLayer/gsp.adoc b/grails-doc/src/en/guide/theWebLayer/gsp.adoc index ac84112fd60..d7fc1e78203 100644 --- a/grails-doc/src/en/guide/theWebLayer/gsp.adoc +++ b/grails-doc/src/en/guide/theWebLayer/gsp.adoc @@ -37,7 +37,7 @@ In addition, for production compilation you should apply the `grails-gsp` Gradle [source,groovy] .build.gradle ---- -apply plugin: "org.apache.grails:grails-gsp" +apply plugin: "org.apache.grails.gradle.grails-gsp" ---- GSPs live in the `grails-app/views` directory and are typically rendered automatically (by convention) or with the link:{controllersRef}render.html[render] method such as: From 118f9daa495cd997506a41e892fc2211249bd00f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Berg=20Glasius?= Date: Wed, 12 Nov 2025 08:20:34 +0100 Subject: [PATCH 2/2] Apply suggestion from @matrei Co-authored-by: Mattias Reichel --- .../src/en/guide/theWebLayer/gson/jsonInstallation.adoc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/grails-doc/src/en/guide/theWebLayer/gson/jsonInstallation.adoc b/grails-doc/src/en/guide/theWebLayer/gson/jsonInstallation.adoc index 95b17914bbb..7e1ca831855 100644 --- a/grails-doc/src/en/guide/theWebLayer/gson/jsonInstallation.adoc +++ b/grails-doc/src/en/guide/theWebLayer/gson/jsonInstallation.adoc @@ -17,12 +17,14 @@ specific language governing permissions and limitations under the License. //// -To activate JSON views, add the following dependency to the `dependencies` block of your `build.gradle`, if you use the Grails BOM: +To activate JSON views, add the following dependency to the `dependencies` block of your `build.gradle` file. + +If you use the Grails BOM: [source,groovy] implementation "org.apache.grails:grails-views-gson" -otherwise add version information +otherwise, add the version explicitly: [source,groovy,subs="attributes"] implementation "org.apache.grails:grails-views-gson:{version}"