From a01876730a98aee6ab7851715533ecdeb3fbb3d5 Mon Sep 17 00:00:00 2001 From: James Fredley Date: Tue, 19 Nov 2024 17:33:29 -0500 Subject: [PATCH 01/10] update documentation based on return to buildscript{} in main build.gradle file --- .../gradleBuild/gradlePlugins.adoc | 2 +- src/en/guide/upgrading/upgrading50x.adoc | 161 ------------------ src/en/ref/Command Line/schema-export.adoc | 4 +- 3 files changed, 3 insertions(+), 164 deletions(-) diff --git a/src/en/guide/commandLine/gradleBuild/gradlePlugins.adoc b/src/en/guide/commandLine/gradleBuild/gradlePlugins.adoc index 52689f4e61..441cd648e2 100644 --- a/src/en/guide/commandLine/gradleBuild/gradlePlugins.adoc +++ b/src/en/guide/commandLine/gradleBuild/gradlePlugins.adoc @@ -1,4 +1,4 @@ -When you create a new project with the link:../ref/Command%20Line/create-app.html[create-app] command, a default `settings.gradle`, `buildSrc` and `build.gradle` is created. The default `build.gradle` configures the build with a set of Gradle plugins that allow Gradle to build the Grails project: +When you create a new project with the link:../ref/Command%20Line/create-app.html[create-app] command, a default `build.gradle` is created. The default `build.gradle` configures the build with a set of Gradle plugins that allow Gradle to build the Grails project: [source,groovy] ---- diff --git a/src/en/guide/upgrading/upgrading50x.adoc b/src/en/guide/upgrading/upgrading50x.adoc index 16220e1aee..17959b8ecf 100644 --- a/src/en/guide/upgrading/upgrading50x.adoc +++ b/src/en/guide/upgrading/upgrading50x.adoc @@ -144,169 +144,8 @@ plugins { } ``` - By migrating to the `plugins` block, your Grails 6 project will adhere to modern Gradle conventions, making it easier to manage plugin dependencies and configurations. This new approach maintains consistency and enhances the overall structure of the project, ensuring a smoother and more efficient development process. -##### 6.2. Use the pluginManagement Block - -Moving from `apply plugin` in the `build.gradle` file to the `pluginManagement` block in the `settings.gradle` file is a significant change introduced in Grails 6. This change is part of Grails' effort to adopt the Gradle `pluginManagement` approach for better plugin version control and consistency across projects. - -In the previous versions of Grails (before Grails 6), developers used to apply plugins directly in the `build.gradle` file using the `apply plugin` syntax. For example: - -.build.gradle -```groovy -buildscript { - repositories { - maven { url "https://plugins.gradle.org/m2/" } - maven { url "https://repo.grails.org/grails/core" } - } - dependencies { - classpath "org.grails:grails-gradle-plugin:$grailsGradlePluginVersion" - classpath "org.grails.plugins:hibernate5:7.3.0" - classpath "org.grails.plugins:views-gradle:2.3.2" - } -} - -version "0.1" -group "hellorestapi" - -apply plugin:"eclipse" -apply plugin:"idea" -apply plugin:"war" -apply plugin:"org.grails.grails-web" -apply plugin:"org.grails.plugins.views-json" -``` - - -However, with Grails 6, the recommended practice is to move plugin declarations to the `pluginManagement` block in the `settings.gradle` file. The `pluginManagement` block acts as a central place to manage plugin versions for all projects within a multi-project build. - -**Configuring Plugins in the pluginManagement Block:** - -Here's how you can declare the `views-json` plugin in the `pluginManagement` block: - - 1. Open the `settings.gradle` file in your Grails 6 project. - - 2. Add the `pluginManagement` block with the `views-json` plugin declaration: - -.settings.gradle -```groovy -pluginManagement { - repositories { - // Add the Grails plugin repository to resolve the views-json plugin - maven { url "https://repo.grails.org/grails/core" } - // Other repositories can be added here if needed - } - - // Declare the views-json plugin and its version - plugins { - id 'org.grails.plugins.views-json' version '3.0.0' - // Other plugins can be declared here - } -} -``` - - -By including the `views-json` plugin in the `pluginManagement` block, Grails 6 will ensure that all projects within the multi-project build use the specified version of the `views-json` plugin. This promotes consistency in JSON rendering across different projects and simplifies maintenance and version control. - -**Moving Older Applications to the New Approach:** - -If you are migrating an older Grails application to Grails 6, you can update the plugin declarations from `apply plugin` to the `plugins` block in the `build.gradle` file, as shown in the previous section. - -By adopting the `pluginManagement` block and declaring the `views-json` plugin in the `settings.gradle` file, you ensure consistent usage of the plugin across all projects in the Grails 6 ecosystem. This approach simplifies plugin version control and improves the overall development experience when working with JSON responses in your Grails applications. - - -##### 6.3 Grails Adoption of "buildSrc" Folder for Buildscript Dependencies - -In previous versions of Grails (before Grails 6), managing buildscript dependencies, such as the `views-gradle` plugin, was typically done directly in the main `build.gradle` file. This enables Gradle compilation of JSON views for production environment. Developers would define the repositories and dependencies needed for the buildscript within the `buildscript` block: - -.build.gradle -```groovy - -buildscript { - repositories { - mavenCentral() - } - dependencies { - // Example: views-gradle plugin - classpath "org.grails.plugins:views-gradle:3.0.0" - } -} - -// Apply the views-json plugin -apply plugin: 'views-json' - -// Other configurations and dependencies -``` - -This approach meant that the buildscript dependencies were mixed with the rest of the project's configurations, making the `build.gradle` file longer and potentially harder to maintain. As a result, the buildscript section might become cluttered with various plugin dependencies and other build logic. - -With the introduction of Grails 6, there is a significant improvement in managing buildscript dependencies through the use of the `buildSrc` folder. This dedicated folder provides a more organized approach to handle buildscript dependencies, custom Gradle plugins, and extensions specific to the project. - -**Benefits of Grails 6 Adoption of "buildSrc" Folder** - - 1. **Modular Build Configuration:** The `buildSrc` folder acts as a separate mini-project within your Grails application, allowing you to encapsulate build logic, plugins, and dependencies. This separation of concerns improves the organization and modularity of the build configuration. - - 2. **Streamlined Buildscript Management:** By moving buildscript dependencies to `buildSrc`, you can keep the main `build.gradle` file clean and focused on the application's specific requirements. This reduces clutter and promotes a more concise and clear build script. - - 3. **Better Collaboration:** The `buildSrc` approach simplifies collaboration within development teams. Build logic can be centralized and shared across projects, enabling a consistent and efficient development workflow. - -**Update from Grails 5** - -The new Grails 6 application uses `buildSrc/build.gradle`. The buildSrc directory can host a build script if additional configuration is needed (e.g. to apply plugins or to declare dependencies). The `buildSrc` folder in a Grails project follows a specific tree layout, which includes the `build.gradle` file. Here's how the tree layout looks like: - -```bash -buildSrc/ -├── build.gradle -└── src/ - └── main/ - └── groovy/ -``` - -**Let's walk through how to manage the `views-gradle` plugin using the `buildSrc` folder in Grails 6:** - -**Step 1: Create buildSrc Folder:** - -In the root directory of your Grails 6 project, create a new folder named `buildSrc`. - -**Step 2: Add buildSrc Script:** - -Inside the `buildSrc` folder, create a build.gradle file and specify the `views-gradle` plugin dependency: - -.buildSrc/build.gradle -```groovy -repositories { - mavenCentral() -} - -dependencies { - implementation "org.grails.plugins:views-gradle:3.0.0" -} -``` - -**Step 3: Remove apply plugin Statement:** - -In the main `build.gradle` file, remove the `buildscript` block and the `apply plugin` statement related to `views-gradle`, as it is now managed in the `buildSrc` folder: - -.build.gradle -```groovy -buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath "org.grails.plugins:views-gradle:3.0.0" - } -} - -// No need to apply views-json plugin here -// Remove the apply plugin statement for views-json if it was previously present -apply plugin: 'views-json' - -// ... Other configurations and dependencies -``` - -By using the `buildSrc` folder, developers can separate buildscript dependencies and custom plugin configurations from the main `build.gradle` file. This leads to a cleaner and more concise build script, which is easier to maintain and understand. Additionally, the `buildSrc` approach encourages modularity, as build logic and custom plugins can be centralized and shared across projects, fostering better collaboration and consistency within development teams. - #### 7. GORM for MongoDB Sync Driver: The GORM for MongoDB is updated to support the latest mongodb-driver-sync. If you are using GORM for MongoDB and making use of specific MongoDB Driver or low-level Mongo API features, consider checking the https://mongodb.github.io/mongo-java-driver/4.0/upgrading/[Upgrading to the 4.0 Driver guide]. diff --git a/src/en/ref/Command Line/schema-export.adoc b/src/en/ref/Command Line/schema-export.adoc index 8e275dae55..f80ef406d8 100644 --- a/src/en/ref/Command Line/schema-export.adoc +++ b/src/en/ref/Command Line/schema-export.adoc @@ -7,14 +7,14 @@ The `schema-export` command uses Hibernate's SchemaExport tool to generate Data == Examples [source,groovy,subs="attributes+"] -.buildSrc/build.gradle +build.gradle ---- repositories { mavenCentral() maven { url = "https://repo.grails.org/grails/core/" } } dependencies { - implementation("org.grails.plugins:hibernate5:{gormVersion}") + classpath "org.grails.plugins:hibernate5:gormVersion" } ---- From 286d96cef3cfe3abf36602361b2e917d4b2e26ba Mon Sep 17 00:00:00 2001 From: James Fredley Date: Tue, 19 Nov 2024 21:35:49 -0500 Subject: [PATCH 02/10] put curly braces back --- src/en/ref/Command Line/schema-export.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/en/ref/Command Line/schema-export.adoc b/src/en/ref/Command Line/schema-export.adoc index f80ef406d8..45f6f89ba3 100644 --- a/src/en/ref/Command Line/schema-export.adoc +++ b/src/en/ref/Command Line/schema-export.adoc @@ -14,7 +14,7 @@ repositories { maven { url = "https://repo.grails.org/grails/core/" } } dependencies { - classpath "org.grails.plugins:hibernate5:gormVersion" + classpath "org.grails.plugins:hibernate5:{gormVersion}" } ---- From e6716f87a80cb4d931de5324a935bc02352a8950 Mon Sep 17 00:00:00 2001 From: James Fredley Date: Wed, 20 Nov 2024 12:02:18 -0500 Subject: [PATCH 03/10] update versions for grails 6.2.2 release --- buildSrc/gradle.properties | 4 ++-- gradle.properties | 6 +++--- src/en/guide/introduction/whatsNew/dependencyUpgrades.adoc | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/buildSrc/gradle.properties b/buildSrc/gradle.properties index 0664d21ef7..6fc7a773d3 100644 --- a/buildSrc/gradle.properties +++ b/buildSrc/gradle.properties @@ -1,2 +1,2 @@ -groovyVersion=3.0.21 -grailsDocsVersion=6.2.1 \ No newline at end of file +groovyVersion=3.0.23 +grailsDocsVersion=6.2.2 \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 9cf68b5186..bfb930f8b8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,12 +1,12 @@ -grails.version=6.2.2-SNAPSHOT +grails.version=6.2.2 githubSlug=grails/grails-doc githubBranch=6.2.x springBootVersion=2.7.18 springVersion=5.3.39 gradleVersion=7.6.4 gormVersion=8.1.2 -groovyVersion=3.0.21 -gspVersion=6.2.3 +groovyVersion=3.0.23 +gspVersion=6.2.4 org.gradle.caching=true org.gradle.daemon=true org.gradle.jvmargs=-Dfile.encoding=UTF-8 -Xmx1536M -XX:MaxMetaspaceSize=768M diff --git a/src/en/guide/introduction/whatsNew/dependencyUpgrades.adoc b/src/en/guide/introduction/whatsNew/dependencyUpgrades.adoc index 4d21573add..56efc3461b 100644 --- a/src/en/guide/introduction/whatsNew/dependencyUpgrades.adoc +++ b/src/en/guide/introduction/whatsNew/dependencyUpgrades.adoc @@ -1,12 +1,12 @@ Grails {version} ships with the following dependency upgrades: -* Groovy 3.0.21 +* Groovy 3.0.23 * Micronaut 3.10.4 * Micronaut for Spring 4.5.1 * GORM 8.1.2 * Spring Framework 5.3.39 * Spring Boot 2.7.18 * Gradle 7.6.4 -* Spock 2.1-groovy-3.0 -* Grails Testing Support 3.2.1 +* Spock 2.3-groovy-3.0 +* Grails Testing Support 3.2.2 From ed0d94cdc015d288ddfd84a59e3c6d88224f8779 Mon Sep 17 00:00:00 2001 From: James Fredley Date: Wed, 20 Nov 2024 12:08:08 -0500 Subject: [PATCH 04/10] adjust grailsDocsVersion to 6.2.2-SNAPSHOT since 6.2.2 does not yet exist --- buildSrc/gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/gradle.properties b/buildSrc/gradle.properties index 6fc7a773d3..c7169457ec 100644 --- a/buildSrc/gradle.properties +++ b/buildSrc/gradle.properties @@ -1,2 +1,2 @@ groovyVersion=3.0.23 -grailsDocsVersion=6.2.2 \ No newline at end of file +grailsDocsVersion=6.2.2-SNAPSHOT \ No newline at end of file From c886c3a39d35b57b9bb582f902e0c2370d60d1fa Mon Sep 17 00:00:00 2001 From: James Fredley Date: Wed, 20 Nov 2024 12:11:43 -0500 Subject: [PATCH 05/10] Adjust grails version to 6.2.2-SNAPSHOT since 6.2.2 does not yet exist --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index bfb930f8b8..943bc6bcc7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -grails.version=6.2.2 +grails.version=6.2.2-SNAPSHOT githubSlug=grails/grails-doc githubBranch=6.2.x springBootVersion=2.7.18 From b6b8d004bc9dab2063bcac3edd1a2c645f29580e Mon Sep 17 00:00:00 2001 From: puneetbehl Date: Wed, 20 Nov 2024 20:17:55 +0000 Subject: [PATCH 06/10] [skip ci] Release v6.2.2 docs --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 943bc6bcc7..bfb930f8b8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -grails.version=6.2.2-SNAPSHOT +grails.version=6.2.2 githubSlug=grails/grails-doc githubBranch=6.2.x springBootVersion=2.7.18 From 8cedec5297bd8d2856c1a009968211a2195f4a68 Mon Sep 17 00:00:00 2001 From: James Fredley Date: Wed, 20 Nov 2024 15:30:13 -0500 Subject: [PATCH 07/10] pull from repo.grails.org to speed up release process instead of waiting on mavenCentral. --- buildSrc/src/main/groovy/grails/doc/DownloadPomTask.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/groovy/grails/doc/DownloadPomTask.groovy b/buildSrc/src/main/groovy/grails/doc/DownloadPomTask.groovy index dc6f8c1397..6a7c1c7072 100644 --- a/buildSrc/src/main/groovy/grails/doc/DownloadPomTask.groovy +++ b/buildSrc/src/main/groovy/grails/doc/DownloadPomTask.groovy @@ -45,7 +45,7 @@ abstract class DownloadPomTask extends DefaultTask { if (version.endsWith('-SNAPSHOT')) { pomUrl = "https://repo.grails.org/ui/api/v1/download?repoKey=core&path=org%252Fgrails%252Fgrails-bom%252F${version}%252Fgrails-bom-${version}.pom&isNativeBrowsing=true" } else { - pomUrl = "https://repo1.maven.org/maven2/org/grails/grails-bom/${version}/grails-bom-${version}.pom" + pomUrl = "https://repo.grails.org/grails/core/org/grails/grails-bom/${version}/grails-bom-${version}.pom" } def pomContent = downloadPomContent(pomUrl) From dcbd032ccaaff85224ed5ce04b0ea9b01806f22a Mon Sep 17 00:00:00 2001 From: puneetbehl Date: Wed, 20 Nov 2024 20:48:13 +0000 Subject: [PATCH 08/10] [skip ci] Release vretry 6.2.2 release docs --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index bfb930f8b8..b874cd78a1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -grails.version=6.2.2 +grails.version=retry 6.2.2 release githubSlug=grails/grails-doc githubBranch=6.2.x springBootVersion=2.7.18 From 2e722e9de6ec7789a0b3f8564bb798ad7417ac5e Mon Sep 17 00:00:00 2001 From: puneetbehl Date: Wed, 20 Nov 2024 20:59:57 +0000 Subject: [PATCH 09/10] [skip ci] Release v6.2.2 docs --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index b874cd78a1..bfb930f8b8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -grails.version=retry 6.2.2 release +grails.version=6.2.2 githubSlug=grails/grails-doc githubBranch=6.2.x springBootVersion=2.7.18 From 4ab0ba692f1ac28b186531f1d6dc1570875d9252 Mon Sep 17 00:00:00 2001 From: James Fredley Date: Wed, 20 Nov 2024 16:33:40 -0500 Subject: [PATCH 10/10] update to grails 6.2.3-SNAPSHOT --- buildSrc/gradle.properties | 2 +- gradle.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/buildSrc/gradle.properties b/buildSrc/gradle.properties index c7169457ec..d9284f7bc7 100644 --- a/buildSrc/gradle.properties +++ b/buildSrc/gradle.properties @@ -1,2 +1,2 @@ groovyVersion=3.0.23 -grailsDocsVersion=6.2.2-SNAPSHOT \ No newline at end of file +grailsDocsVersion=6.2.3-SNAPSHOT \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index bfb930f8b8..e6c1c85965 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -grails.version=6.2.2 +grails.version=6.2.3-SNAPSHOT githubSlug=grails/grails-doc githubBranch=6.2.x springBootVersion=2.7.18