Creating Your First Grails Application

Site Admin · 11 Sep 2026 · 7 views

Setting Up the Environment

Before creating a Grails application, you need Java Development Kit (JDK) 8 or higher and the Grails SDK installed. You can install Grails using SDKMAN or by downloading it from the Apache Grails website.

# Install via SDKMAN
sdk install grails

# Verify installation
grails --version

Generating a New Application

Use the Grails CLI to create a new project:

grails create-app myapp

This generates a standard project structure with all the conventional directories. The command creates configuration files, a build script using Gradle, and starter code.

Project Structure

After generation, your project looks like this:

myapp/
  grails-app/
    controllers/
    domain/
    services/
    views/
    conf/
  src/
  build.gradle

The grails-app directory is the heart of your application. Each subdirectory has a specific purpose following Grails conventions.

Running the Application

Start the embedded server with a single command:

grails run-app

Your application will start on port 8080 by default. Navigate to http://localhost:8080 to see the welcome page.

Key Points

  • Install Grails via SDKMAN for easy version management.
  • grails create-app generates a complete project structure.
  • The grails-app directory contains all application code organized by convention.
  • grails run-app starts the development server.
  • Grails uses Gradle as its build tool by default.
Share this post:

Comments (0)

Please login or register to comment.