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

[NOTE]
====
The `create-app` and related commands are available in both the Grails Shell CLI and the Grails Forge CLI.

- To create a project using the default Grails Shell CLI:
`$ grails create-app myapp`
- To use Forge-specific options (such as `--java-version`, `--features`, etc.):  
`$ grails -t forge create-app myapp`

====

The primary command for creating a new project is `create-app`, which creates a standard Grails web application that communicates over HTTP. For other types of applications, see the documentation below.

Creating a project is the primary usage of the Grails Forge CLI.  You can also generate an application with grails-shell, which uses profiles for generation.

The `create-app` and other commands support extended options in Forge, which must be run using the following format:

[source,console]
----
$ ./grails -t forge create-app myapp
----

After generating a project with Forge, switch to the created directory and use the default Grails shell CLI (`./grails`) to manage, run, test, and deploy your application.

[cols="1,3,4a,8a"]
|===
| Command | Description | Options | Example

| create-app / create-webapp
| Creates a Grails web application
|
[none]
* -jdk, --java-version
* -s, --servlet
* -g, --gorm
* -t, --test
* -f, --features
* -i, --inplace
|
[source,console]
----
./grails -t forge create-app \
    --servlet=tomcat \
    --jdk=11 \
    --gorm=hibernate \
    --test=spock \
    --features=github-workflow-java-ci \
    com.example.demo
----

| create-restapi
| Creates a Grails REST API application
|
[none]
* -jdk, --java-version
* -s, --servlet
* -g, --gorm
* -t, --test
* -f, --features
* -i, --inplace
|
[source,console]
----
./grails -t forge create-restapi \
    --servlet=tomcat \
    --jdk=11 \
    --gorm=hibernate \
    --test=spock \
    --features=github-workflow-java-ci \
    com.example.demo
----

| create-plugin
| Creates a Grails Plugin application
|
[none]
* -jdk, --java-version
* -s, --servlet
* -g, --gorm
* -t, --test
* -f, --features
* -i, --inplace
|
[source,console]
----
./grails -t forge create-plugin \
    --servlet=tomcat \
    --jdk=11 \
    --gorm=hibernate \
    --test=spock \
    --features=github-workflow-java-ci \
    com.example.demo
----

| create-web-plugin
| Creates a Grails Web Plugin application
|
[none]
* -jdk, --java-version
* -s, --servlet
* -g, --gorm
* -t, --test
* -f, --features
* -i, --inplace
|
[source,console]
----
./grails -t forge create-web-plugin \
    --servlet=tomcat \
    --jdk=11 \
    --gorm=hibernate \
    --test=spock \
    --features=github-workflow-java-ci \
    com.example.demo
----
|===

=== The `create-` command flags

The "create-*" commands are used to produce a fundamental Grails project, allowing for the inclusion of optional flags to select additional features, to customize GORM settings, an embedded servlet, the test framework, and the Java version.

[cols="4,8,6a"]
|===
| Flag | Description | Example

| -jdk, --java-version
| The JDK version the project should target
|
[source,shell]
----
--java-version 21
----

| -s, --servlet
| Which Servlet Implementation to configure. Possible values: none, tomcat, jetty, undertow.
|
[source,shell]
----
--servlet=tomcat
----

| -g, --gorm
| Which GORM Implementation to configure. Possible values: hibernate, mongodb, neo4j.
|
[source,shell]
----
--gorm hibernate
----

| -t, --test
| Which test framework to use. Possible values: junit, spock.
|
[source,shell]
----
--test spock
----

| -f, --features
| The features to use. Possible values: h2, gorm-hibernate5, spring-boot-starter-jetty, 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, grails-web-console, logbackGroovy, mongo-sync, shade, properties
|
[source,shell]
----
--features github-workflow-java-ci,micronaut-http-client
----

| -i, --inplace
| Create a project using the current directory
|
[source,shell]
----
--inplace
----

|===