Grails 3 introduced the concept of application profiles to Grails. A profile contains the application structure, dependencies, commands and more to configure Grails for a specific type of application. The profiles are stored on the Grails Profile repository on Github. We can go there and see which profiles are available, but it is much easier to use the list-profiles
command. With this command we get an overview of all the available profiles we can use to create a new application or plugin.
The list-profiles
task is only available when we are outside a Grails application directory. So just like the create-app
and create-plugin
we can run list-profiles
from a non-Grails project directory.
$ grails list-profiles | Available Profiles -------------------- * base - The base profile extended by other profiles * plugin - Profile for plugins designed to work across all profiles * web - Profile for Web applications * web-api - Profile for Web API applications * web-micro - Profile for creating Micro Service applications run as Groovy scripts * web-plugin - Profile for Plugins designed for Web applications $
Once we know which profile we want to use we can use the name as value for the --profile
option with the create-app
command:
$ grails create-app sample-micro --profile=web-micro | Application created at /Users/mrhaki/Projects/mrhaki.com/blog/posts/samples/grails3/sample-micro $
Written with Grails 3.0.8.