Profile Structure vs Templates
Site Admin
· 11 Sep 2026
· 11 views
Understanding Profiles
Grails profiles define the structure and dependencies of a project. They replaced the older template system and provide a more modular approach to project generation.
Available Profiles
- web-profile - Full-stack with GSP, controllers, services, and domain classes
- rest-api - Optimized for REST APIs without view layer
- base - Minimal profile with core features only
- plugin - For creating reusable Grails plugins
Profile Directory Structure
myapp/
grails-app/
controllers/
domain/
services/
views/
conf/
init/
src/
gradle/
build.gradle
gradlew
Each profile determines which directories are created and which dependencies are included.
Creating with a Specific Profile
# REST API project
grails create-app myapi --profile rest-api
# Full-stack web app
grails create-app myapp --profile web-profile
Template System (Legacy)
The older template system used grails create-app with template overrides. Profiles are now the preferred approach as they are more maintainable and provide better defaults.
Custom Profiles
You can create custom profiles for your organization:
grails create-profile myProfile
Custom profiles let you standardize project structure, dependencies, and build configuration across teams.
Key Points
- Profiles define project structure and dependencies.
- Use
--profileflag when creating applications. - The
rest-apiprofile omits the view layer for REST-only projects. - Custom profiles standardize team project structures.
- Profiles replaced the older template system.