////
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
////

== 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.

[NOTE]
====
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.

[source,console]
----
$ grails create-app bookstore
$ cd bookstore
----

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

[source,console]
----
$ 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`):

[source,shell]
----
$ 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**:
+
[source,console]
----
$ grails create-app bookstore
$ cd bookstore
----

2. **Create an app using the Forge CLI with advanced options**:
+
[source,console]
----
$ grails -t forge create-app bookstore \
    --jdk=17 \
    --gorm=hibernate \
    --features=asciidoctor,grails-gsp
----

3. **Create an app in the current directory (both CLIs)**:
+
[source,console]
----
$ mkdir bookstore
$ cd bookstore
$ grails create-app --inplace
----
_or_
[source,console]
----
$ grails -t forge create-app --inplace
----
