Grails - Creating Profiles



Description

Creating profile gives you advantage of setting up the commands and plugins that are customized to a specific technology or organisation.

For creating a new profile you can use the following command:

grails create-profile mygrailsprofile

The above command will create mygrailsprofile directory, which will be a new empty profile that extends the base profile. The following table gives a brief explanation of the commands which can be executed:

S.N.Command & Description
1 create-command
This command will create commands, which are be accessible from Grails CLI when the specific profile is used.
2 create-creator-command
This command will create commands, which are accessible to the CLI that provides a template.
3 create-generator-command
It will create commands, accessible to the CLI that provides a template based on a domain class.
4 create-feature
It creates feature which are use full for a given profile.
5 create-gradle-command
It creates comm which will call on gradle.
6 create-template
This command will create templates which are supplied by command.

You can add additional dependencies in profile.yml file. Below is an sample format for profile.yml file:

features:
    defaults:
        - hibernate
        - asset-pipeline
build:
    plugins:
        - org.grails.grails-web
    excludes:
        - org.grails.grails-core
dependencies:
    compile:
        - "org.mygrailsprofile:myplugin:1.0.1"

To publish the profile to your local repository use the following command:

gradle install

To create an application with particular defined profile use the following command

grails create-app grailsapp --profile mygrailsprofile

After running the above command, the application will be created with mygrailsprofile profile with the features like hibernate and asset-pipeline.

Advertisements