Creating Grails Application Elements
IntelliJ IDEA enables easy creation of the Grails or Griffon Application elements in the modules of the corresponding type (domain classes, controllers, scripts etc.) You can create new elements using the application-specific Grails or Griffon tool windows, or the Project tool window.
Execution of the target that corresponds to the selected element type, is displayed in the console.
To add a new Grails or Griffon element
- Open Grails or Griffon tool window, depending on the desired application type, and right-click the package where a new application element should be added.
- On the context menu of the destination package, choose , or press Alt+Insert, and choose the element type.
- Type the name of the new element. So doing, you may not care about capitalization: when a new element is generated, its name is capitalized automatically. Click OK. A Groovy class of the selected type is created in the location stipulated by the application structure.
- Add the necessary source code in the editor, using the Groovy-aware coding assistance, refactorings and intention actions.
IntelliJ IDEA provides the possibility to create Grails filters in one click. Just press Alt+Insert, and choose
CreateFilters.groovy target, the stub class with the filter definition is created under
grails-app/conf directory of your Grails application.
Note that IntelliJ IDEA automatically provides the proper name of your filter class (
*Filters.groovy), so you only need to specify the initial characters of the filter class name.