IntelliJ IDEA 2021.2 Help

Create 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

  1. Open the Grails tool window, depending on the desired application type, and right-click the package where a new application element should be added.

  2. On the context menu of the destination package, choose New, or press Alt+Insert, and choose the element type.

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

  4. 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 Grails Filter on the popup menu. After executing the 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.

Last modified: 27 August 2021