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

Update docs for Grails 7 #929

Merged
merged 11 commits into from
Dec 20, 2024
20 changes: 9 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'base'
id 'org.asciidoctor.jvm.convert' version '4.0.0-alpha.1'
id 'org.asciidoctor.jvm.convert' version '4.0.3'
id 'org.grails.grails-gdoc-to-asciidoc'
id 'groovy'
}
Expand All @@ -9,6 +9,8 @@ repositories {
maven { url = "https://repo.grails.org/grails/core" }
}

compileJava.options.release = 17

import org.apache.tools.ant.taskdefs.condition.Os

version = project.findProperty("grails.version")
Expand Down Expand Up @@ -39,10 +41,10 @@ configurations {

gdoc2asciidoc {
apiLinks = ['org.hibernate' : 'https://docs.jboss.org/hibernate/orm/current/javadocs/',
'org.springframework.boot' : 'https://docs.spring.io/spring-boot/docs/2.5.2/api',
'org.springframework' : 'https://docs.spring.io/spring/docs/5.3.8/javadoc-api/',
'javax.servlet' : 'https://docs.oracle.com/javaee/1.4/api/',
'java.' : 'https://docs.oracle.com/javase/6/docs/api/',
'org.springframework.boot' : "https://docs.spring.io/spring-boot/docs/$springBootVersion/api",
'org.springframework' : "https://docs.spring.io/spring/docs/$springVersion/javadoc-api/",
'jakarta.servlet' : 'https://jakarta.ee/specifications/servlet/6.0/',
'java.' : 'https://docs.oracle.com/en/java/javase/17/docs/api/',
'groovy.' : 'https://docs.groovy-lang.org/docs/latest/html/api/',
'org.codehaus.groovy.grails': "https://docs.grails.org/$githubBranch/api",
'grails.orm.' : 'https://gorm.grails.org/latest/api',
Expand Down Expand Up @@ -161,7 +163,7 @@ tasks.register('publishGuide', grails.doc.gradle.PublishGuide) {
propertiesFiles = [new File(projectDir, "gradle.properties")]
asciidoc = true
properties = [
'javaee' : "https://docs.oracle.com/javaee/7/api/",
'jakartaee' : "https://jakarta.ee/specifications/platform/10/apidocs/",
'javase' : "https://docs.oracle.com/en/java/javase/17/docs/api/",
'groovyapi' : "https://docs.groovy-lang.org/${groovyVersion}/html/gapi/",
'springapi' : "https://docs.spring.io/spring/docs/${springVersion}/javadoc-api/",
Expand Down Expand Up @@ -217,8 +219,4 @@ artifacts {
archives dist
}

java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
compileJava.options.release = 17
6 changes: 1 addition & 5 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@ repositories {
maven { url = "https://repo.grails.org/grails/core" }
}

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

configurations {
configureEach {
Expand Down
4 changes: 3 additions & 1 deletion buildSrc/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
groovyVersion=4.0.22
groovyVersion=4.0.24

# This references grails-core/grails-docs
grailsDocsVersion=7.0.0-SNAPSHOT
12 changes: 8 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
grails.version=7.0.0-SNAPSHOT

githubSlug=grails/grails-doc
githubBranch=7.0.x
springBootVersion=3.2.6
springVersion=6.1.8
gradleVersion=8.10
springBootVersion=3.4.0
springVersion=6.2.0
gradleVersion=8.11.1
gormVersion=9.0.0-SNAPSHOT
groovyVersion=4.0.22
groovyVersion=4.0.24
gspVersion=7.0.0-SNAPSHOT

grailsGdocVersion=1.0.1

org.gradle.caching=true
org.gradle.daemon=true
org.gradle.jvmargs=-Dfile.encoding=UTF-8 -Xmx1536M -XX:MaxMetaspaceSize=768M
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
10 changes: 5 additions & 5 deletions resources/doc.properties
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ alias.urlmappings=6.4 URL Mappings
alias.validation=7. Validation
alias.XML=6.1.7 XML and JSON Responses

# javadoc alias used to link to external javadocs in the form [HttpServletRequest|api:javax.servlet.http.HttpServletRequest]
# javadoc alias used to link to external javadocs in the form [HttpServletRequest|api:jakarta.servlet.http.HttpServletRequest]
api.org.hibernate=https://docs.jboss.org/hibernate/orm/current/javadocs/
api.org.springframework.boot=http://docs.spring.io/spring-boot/docs/current/api
api.org.springframework=https://docs.spring.io/spring/docs/current/javadoc-api/
api.javax.servlet=https://docs.oracle.com/javaee/7/api/
api.java.=https://docs.oracle.com/javase/11/docs/api/
api.org.springframework.boot=https://docs.spring.io/spring-boot/api/java/index.html
api.org.springframework=https://docs.spring.io/spring-framework/docs/current/javadoc-api/
api.jakarta.servlet=https://jakarta.ee/specifications/platform/10/apidocs/
api.java.=https://docs.oracle.com/en/java/javase/17/docs/api/
api.groovy.=http://docs.groovy-lang.org/docs/latest/html/api
api.org.codehaus.groovy.grails=http://docs.grails.org/latest/api/
api.grails.orm.=http://gorm.grails.org/latest/hibernate/api
Expand Down
5 changes: 3 additions & 2 deletions src/en/guide/REST/callingRestServices.adoc
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
Calling Grails REST services - as well as third-party services - is very straightforward using the https://docs.micronaut.io/latest/guide/index.html#httpClient[Micronaut HTTP Client]. This HTTP client has both a low-level API and a higher level AOP-driven API, making it useful for both simple requests as well as building declarative, type-safe API layers.

To use the Micronaut HTTP client you must have the `micronaut-http-client` dependency on your classpath. Add the following dependency to your `build.gradle` file.
To use the Micronaut HTTP client you must have the `micronaut-http-client` and `micronaut-serde-jackson` dependencies on your classpath. Add the following dependency to your `build.gradle` file.

.build.gradle
[source,groovy]
----
implementation 'io.micronaut:micronaut-http-client'
implementation "io.micronaut:micronaut-http-client:4.6.6"
implementation "io.micronaut.serde:micronaut-serde-jackson:2.11.0"
----

==== Low-level API
Expand Down
2 changes: 1 addition & 1 deletion src/en/guide/REST/renderers/objectMarshallers.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Note that if you have many custom marshallers it is recommended you split the re
----
class CustomMarshallerRegistrar {

@javax.annotation.PostConstruct
@jakarta.annotation.PostConstruct
void registerMarshallers() {
JSON.registerObjectMarshaller(DateTime) {
return it?.toString("yyyy-MM-dd'T'HH:mm:ss'Z'")
Expand Down
2 changes: 1 addition & 1 deletion src/en/guide/REST/restProfile.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,6 @@ $ grails create-domain-class my.api.Book
$ ./gradlew runCommand -Pargs="generate-all my.api.Book"
----

NOTE: The generate-* commands are only available after adding the `org.grails.plugins:scaffolding` dependency to your project. They are not available by default in a REST application. Also, they will no longer produce *.gson files as that was a feature of the REST API-profile. Profiles where removed in Grails 6.
NOTE: The generate-* commands are only available after adding the `org.grails.plugins:scaffolding` dependency to your project. They are not available by default in a REST application. Also, they will no longer produce *.gson files as that was a feature of the REST API-profile.

Instead of CRUD HTML interface a REST endpoint is generated that produces JSON responses. In addition, the generated functional and unit tests by default test the REST endpoint.
1 change: 0 additions & 1 deletion src/en/guide/commandLine.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ features:
- grails-web-testing-support
- h2
- logback
- micronaut-inject-groovy
- readme
- scaffolding
- spock
Expand Down
2 changes: 1 addition & 1 deletion src/en/guide/commandLine/creatingProject.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ mongodb, neo4j.
----

| -f, --features
| The features to use. Possible values: h2, gorm-hibernate5, spring-boot-starter-jetty, springloaded, micronaut-http-client, cache-ehcache, hibernate-validator, postgres, mysql, cache, database-migration, grails-gsp, hamcrest, gorm-mongodb, assertj, mockito, spring-boot-starter-undertow, micronaut-inject-groovy, github-workflow-java-ci, jrebel, testcontainers, sqlserver, grails-console, views-markup, views-json, gorm-neo4j, asciidoctor, embedded-mongodb, grails-web-console, logbackGroovy, mongo-sync, shade, properties
| The features to use. Possible values: h2, gorm-hibernate5, spring-boot-starter-jetty, springloaded, micronaut-http-client, cache-ehcache, hibernate-validator, postgres, mysql, cache, database-migration, grails-gsp, hamcrest, gorm-mongodb, assertj, mockito, spring-boot-starter-undertow, github-workflow-java-ci, jrebel, testcontainers, sqlserver, grails-console, views-markup, views-json, gorm-neo4j, asciidoctor, embedded-mongodb, grails-web-console, logbackGroovy, mongo-sync, shade, properties
|
[source,shell]
----
Expand Down
86 changes: 45 additions & 41 deletions src/en/guide/commandLine/gradleBuild/gradleDependencies.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,51 +5,55 @@ The default dependencies for the Grails Web application can be seen below:
[source,groovy]
----
dependencies {
implementation("org.grails:grails-core")
implementation("org.grails:grails-logging")
implementation("org.grails:grails-plugin-databinding")
implementation("org.grails:grails-plugin-i18n")
implementation("org.grails:grails-plugin-interceptors")
implementation("org.grails:grails-plugin-rest")
implementation("org.grails:grails-plugin-services")
implementation("org.grails:grails-plugin-url-mappings")
implementation("org.grails:grails-web-boot")
implementation("org.grails.plugins:gsp")
implementation("org.grails.plugins:hibernate5")
implementation("org.grails.plugins:scaffolding")
implementation("org.hibernate:hibernate-core:5.6.15.Final")
implementation("org.springframework.boot:spring-boot-autoconfigure")
implementation("org.springframework.boot:spring-boot-starter")
implementation("org.springframework.boot:spring-boot-starter-actuator")
implementation("org.springframework.boot:spring-boot-starter-logging")
implementation("org.springframework.boot:spring-boot-starter-tomcat")
implementation("org.springframework.boot:spring-boot-starter-validation")
compileOnly("io.micronaut:micronaut-inject-groovy")
console("org.grails:grails-console")
runtimeOnly("com.bertramlabs.plugins:asset-pipeline-grails:4.3.0")
runtimeOnly("com.h2database:h2")
runtimeOnly("javax.xml.bind:jaxb-api:2.3.1")
runtimeOnly("org.apache.tomcat:tomcat-jdbc")
runtimeOnly("org.fusesource.jansi:jansi:1.18")
runtimeOnly("org.glassfish.web:el-impl:2.2.1-b05")
testImplementation("io.micronaut:micronaut-inject-groovy")
testImplementation("org.grails:grails-gorm-testing-support")
testImplementation("org.grails:grails-web-testing-support")
testImplementation("org.grails.plugins:geb")
testImplementation("org.seleniumhq.selenium:selenium-api:4.10.0")
testImplementation("org.seleniumhq.selenium:selenium-remote-driver:4.10.0")
testImplementation("org.seleniumhq.selenium:selenium-support:4.10.0")
testImplementation("org.spockframework:spock-core")
testRuntimeOnly("org.seleniumhq.selenium:selenium-chrome-driver:4.10.0")
testRuntimeOnly("org.seleniumhq.selenium:selenium-firefox-driver:4.10.0")
testRuntimeOnly("org.seleniumhq.selenium:selenium-safari-driver:4.10.0")
testImplementation("io.micronaut:micronaut-http-client")

profile "org.grails.profiles:web"
implementation "org.grails:grails-core"
implementation "org.grails:grails-logging"
implementation "org.grails:grails-plugin-databinding"
implementation "org.grails:grails-plugin-i18n"
implementation "org.grails:grails-plugin-interceptors"
implementation "org.grails:grails-plugin-rest"
implementation "org.grails:grails-plugin-services"
implementation "org.grails:grails-plugin-url-mappings"
implementation "org.grails:grails-web-boot"
implementation "org.grails.plugins:gsp"
implementation "org.grails.plugins:hibernate5"
implementation "org.grails.plugins:scaffolding"
implementation "org.springframework.boot:spring-boot-autoconfigure"
implementation "org.springframework.boot:spring-boot-starter"
implementation "org.springframework.boot:spring-boot-starter-actuator"
implementation "org.springframework.boot:spring-boot-starter-logging"
implementation "org.springframework.boot:spring-boot-starter-tomcat"
implementation "org.springframework.boot:spring-boot-starter-validation"
console "org.grails:grails-console"
runtimeOnly "com.bertramlabs.plugins:asset-pipeline-grails"
runtimeOnly "com.h2database:h2"
runtimeOnly "org.apache.tomcat:tomcat-jdbc"
runtimeOnly "org.fusesource.jansi:jansi"
integrationTestImplementation testFixtures("org.grails.plugins:geb")
testImplementation "org.grails:grails-gorm-testing-support"
testImplementation "org.grails:grails-web-testing-support"
testImplementation "org.spockframework:spock-core"
}
----

Note that version numbers are not present in the majority of the dependencies. This is thanks to the dependency management plugin which configures a Maven BOM that defines the default dependency versions for certain commonly used dependencies and plugins:
Note that version numbers are not present in the majority of the dependencies.

This is thanks to the Spring dependency management plugin which automatically configures `grails-bom` as a Maven BOM via the Grails Gradle Plugin. This defines the default dependency versions for most commonly used dependencies and plugins.

For a Grails App, applying `org.grails:grails-gradle-plugin` will automatically configure the `grails-bom`. No other steps required.

For Plugins and Projects which do not use `org.grails:grails-gradle-plugin`, you can apply the `grails-bom` in one of the following two ways.

build.gradle, using Gradle Platforms:
[source,groovy]
----
dependencies {
implementation platform("org.grails:grails-bom:$grailsVersion")
// all other dependencies
}
----

build.gradle, using Spring dependency management plugin:
[source,groovy]
----
dependencyManagement {
Expand Down
3 changes: 1 addition & 2 deletions src/en/guide/commandLine/interactiveMode.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Creates an application
spring-boot-starter-jetty, springloaded, spring-boot-starter-tomcat,
micronaut-http-client, cache-ehcache, hibernate-validator, postgres,
mysql, cache, database-migration, grails-gsp, hamcrest, gorm-mongodb,
assertj, mockito, spring-boot-starter-undertow, micronaut-inject-groovy,
assertj, mockito, spring-boot-starter-undertow,
github-workflow-java-ci, jrebel, testcontainers, sqlserver,
grails-console, views-markup, asset-pipeline-grails, views-json,
gorm-neo4j, asciidoctor, embedded-mongodb, grails-web-console,
Expand Down Expand Up @@ -123,7 +123,6 @@ Available Features
Other
geb (+) This plugins configure Geb for Grails framework to write automation tests.
grails-console (+) Starts the Grails console, which is an extended version of the regular Groovy console.
micronaut-inject-groovy (+) micronaut-inject-groovy
scaffolding (+) The Grails® framework Scaffolding plugin replicates much of the functionality from Grails 2, but uses the fields plugin instead.

Packaging
Expand Down
2 changes: 1 addition & 1 deletion src/en/guide/deployment/deploymentContainer.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ testImplementation "org.springframework.boot:spring-boot-starter-tomcat"

== Application servers

The Grails framework requires that runtime containers support Servlet 3.0 and above. By default, Grails framework applications are bundled with an embeddable Tomcat and testing is primarily done with Tomcat. Any servlet container meeting the minimum requirements should be able to run Grails framework applications, but some workarounds may be required for container-specific bugs or configurations.
The Grails framework requires that runtime containers support Servlet 6.0.0 and above. By default, Grails framework applications are bundled with an embeddable Tomcat and testing is primarily done with Tomcat. Any servlet container meeting the minimum requirements should be able to run Grails framework applications, but some workarounds may be required for container-specific bugs or configurations.
2 changes: 1 addition & 1 deletion src/en/guide/gettingStarted/ide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Because Grails is built upon the https://spring.io[Spring Framework] (Spring Boo

IntelliJ IDEA is a widely used IDE for Grails development. It offers comprehensive support for Groovy and Grails, including features like code-completion, intelligent code analysis, and seamless integration with Grails artefacts.

IntelliJ IDEA also provides powerful database tools that work with Grails' GORM (Grails Object Relational Mapping) seamlessly. It offers both a Community (free) and Ultimate (paid) edition, with the latter offering more advanced Grails support, including an embedded version of the https://start.grails.org[Grails Forge], and view resolution for both GSPs and JSON views.
IntelliJ IDEA also provides powerful database tools that work with Grails' GORM (Grails Object Relational Mapping) seamlessly. It offers both a Community (free) and Ultimate (paid) edition, with the latter offering more advanced Grails support via the regularly updated https://plugins.jetbrains.com/plugin/18504-grails/versions[Grails Plugin], including an embedded version of the https://start.grails.org[Grails Forge], and view resolution for both GSPs and JSON views.

https://www.jetbrains.com/idea/[IntelliJ IDEA Website]

Expand Down
3 changes: 3 additions & 0 deletions src/en/guide/gettingStarted/requirements.adoc
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
Before installing Grails you will need a Java Development Kit (JDK) installed with the minimum version denoted in the table below. Download the appropriate JDK for your operating system, run the installer, and then set up an environment variable called `JAVA_HOME` pointing to the location of this installation.

We recommend https://bell-sw.com/pages/downloads/#jdk-17-lts[Liberica JDK 17 LTS] based on https://spring.io/quickstart[Spring's JDK recommendation].

[cols="1,1"]
|===
| Grails version | JDK version (minimum)

| 7 | 17
| 6 | 11
| 5 | 8
|===
Expand Down
3 changes: 3 additions & 0 deletions src/en/guide/gettingStarted/supportedJakartaEEContainers.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
The Grails framework requires that runtime containers support Servlet 6.0.0 and above. By default, Grails framework applications are bundled with an embedded Tomcat server. For more information, please see the link:deployment.html[Deployment] section of this documentation.

In addition, read the https://guides.grails.org/[Grails Guides] for tips on how to deploy Grails to various popular Cloud services.
3 changes: 0 additions & 3 deletions src/en/guide/gettingStarted/supportedJavaEEContainers.adoc

This file was deleted.

6 changes: 3 additions & 3 deletions src/en/guide/hibernate/mappingWithHibernateAnnotations.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ To map a domain class with annotations, create a new class in `src/main/groovy/`
----
package com.books;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id;

@Entity
public class Book {
Expand Down
10 changes: 5 additions & 5 deletions src/en/guide/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Puneet Behl, Graeme Rocher, Peter Ledbrook, Marc Palmer, Jeff Brown, Luke Daley,
include::introduction.adoc[]

[[whatsNew]]
=== What's new in Grails 6?
=== What's new in Grails 7?

include::introduction/whatsNew.adoc[]

Expand Down Expand Up @@ -73,10 +73,10 @@ include::gettingStarted/testingAnApplication.adoc[]

include::gettingStarted/deployingAnApplication.adoc[]

[[supportedJavaEEContainers]]
=== Supported Java EE Containers
[[supportedJakartaEEContainers]]
=== Supported Jakarta EE Containers

include::gettingStarted/supportedJavaEEContainers.adoc[]
include::gettingStarted/supportedJakartaEEContainers.adoc[]

[[creatingArtefacts]]
=== Creating Artefacts
Expand Down Expand Up @@ -802,7 +802,7 @@ include::async/asyncGorm.adoc[]
include::async/asyncRequests.adoc[]

[[asyncServletApi]]
=== Servlet 3.0 Async
=== Servlet 6.0.0 Async

include::async/asyncServletApi.adoc[]

Expand Down
Loading
Loading