Setting Up the Environment and Your First Grails 6 App
System Requirements
Before installing anything, make sure your machine is ready. Grails 6 needs a JDK of 11 or 17 (17 is recommended), at least 8 GB of RAM for a comfortable experience, about 5 GB of free disk space, and an internet connection for dependency downloads.
Install Java
Verify Java is present:
java -versionIf nothing appears, install a distribution such as OpenJDK, Eclipse Temurin, or Oracle JDK, then set JAVA_HOME and add Java to your PATH so the command works from any terminal.
Install SDKMAN
SDKMAN is the easiest way to manage Grails versions on Linux and macOS:
curl -s "https://get.sdkman.io" | bashRestart your terminal and verify:
sdk versionOn Windows, SDKMAN works best inside WSL. You can also use Chocolatey or install Grails manually.
Install Grails 6
sdk install grails 6.0.0
grails -versionThis installs and pins Grails as your active SDK version.
Configure IntelliJ IDEA
IntelliJ Community or Ultimate both support Grails. Enable the Groovy and Grails plugins, set the JDK to Java 17 in the project settings, and restart the IDE. IntelliJ will then give you code completion, navigation, and debugging for Grails projects.
Create Your First Application
grails create-app demoapp
cd demoapp
grails run-appOpen http://localhost:8080 and you will see the default Grails welcome page.
Generated Project Structure
Grails scaffolds a standardized layout:
- grails-app/controllers - Web controllers that handle requests.
- grails-app/domain - GORM domain classes.
- grails-app/services - Business logic.
- grails-app/views - GSP templates and layouts.
- grails-app/conf - Application configuration.
- grails-app/init - Application class and BootStrap.
- grails-app/assets - CSS, JavaScript, and images.
Environment-Specific Runs
Run in development mode (the default):
grails run-appRun against a specific environment:
grails -Dgrails.env=production run-appCommon Setup Issues
- Incorrect JAVA_HOME causes cryptic Gradle errors.
- An unsupported Java version fails at startup.
- Network restrictions block plugin downloads.
Most problems trace back to Java or SDKMAN configuration, so verify those first.
Key Points
- Install JDK 17, then SDKMAN, then Grails 6.
- IntelliJ with the Grails plugin is the best IDE setup.
- grails create-app scaffolds a complete project.
- grails run-app starts the embedded Tomcat server.
- Learn the grails-app directory layout early.