(Quick Reference)

create-app

Description

The create-app command serves as the initial step in Grails application development. When invoked, this command generates a Grails application with a user-specified name. Subsequently, it creates a subdirectory based on the provided application name within the directory where the command is executed.

In Grails 7, create-app is available in both the Grails Shell CLI and the Forge CLI.

  • Most users should use the Grails Shell CLI by default (grails create-app bookstore). This version supports core development commands and project lifecycle management, and includes basic create-* flags like --inplace, --features, and --profile.

  • The Forge CLI (grails -t forge create-app bookstore) is intended solely for application generation with extended configuration flags such as --jdk, --gorm, and --servlet.

Forge-specific flags will result in an error if used with the Shell CLI.

Usage

This uses the Shell CLI to create a standard Grails application in a new bookstore folder.

$ grails create-app bookstore
$ cd bookstore

This uses the Forge CLI to generate an application with extended configuration options.

$ grails -t forge create-app bookstore \
    --jdk=17 \
    --gorm=hibernate \
    --servlet=tomcat \
    --test=spock \
    --features=asciidoctor,github-workflow-java-ci

Options (Forge CLI)

These options are available only when using grails -t forge:

  • NAME: The desired name for the application.

  • -f, --features=FEATURE[,FEATURE…​]: Enable features like gorm-hibernate5, postgres, asciidoctor, grails-gsp, etc.

  • -g, --gorm=GORM Implementation: Choose GORM implementation: hibernate, mongodb, neo4j.

  • --jdk=<javaVersion>: Target JDK version (e.g., 11 or 17).

  • -s, --servlet=Servlet Implementation: Choose embedded servlet: tomcat, jetty, undertow, none.

  • -t, --test=TEST: Select test framework: spock, junit.

  • -i, --inplace: Create app in current directory.

Shell CLI Support

The following minimal flags are supported with the Shell CLI (grails):

$ grails create-app bookstore
$ grails create-app --inplace

Available flags: - --inplace - --features (limited support depending on profile) - --profile

Forge-only options such as --jdk, --gorm, or --servlet are not supported in the Shell CLI.

Examples

  1. Create an app using the Shell CLI:

    $ grails create-app bookstore
    $ cd bookstore
  2. Create an app using the Forge CLI with advanced options:

    $ grails -t forge create-app bookstore \
        --jdk=17 \
        --gorm=hibernate \
        --features=asciidoctor,grails-gsp
  3. Create an app in the current directory (both CLIs):

    $ mkdir bookstore
    $ cd bookstore
    $ grails create-app --inplace

    or

$ grails -t forge create-app --inplace