Over a million developers have joined DZone.

Easy Grails with IntelliJ IDEA

DZone 's Guide to

Easy Grails with IntelliJ IDEA

· Java Zone ·
Free Resource
This post opens a series of articles related to Groovy and Grails development with IntelliJ IDEA 8. Today we’ll discuss some general enhancements that IntelliJ IDEA has introduced to Grails support. While working with the Grails framework in IntelliJ IDEA, you don’t need to care about the complicated structure of a Grails project: IntelliJ IDEA now provides a special module type named “Grails Application”:










A Grails Application is created with all the necessary infrastructure and artifacts required by the Grails specification:
















Populate your Grails Application with the Grails elements as usual, using context menu:







You don’t need to care about capitalization and proper placement of the new elements: IntelliJ IDEA generates elements’ names with correct capitalization, and automatically places the new elements to the corresponding folders under the grails-app directory. For example, if you create a Grails domain class, it will be added to the domain folder, a Grails controller will be added to the controllers folder, etc.:











Once a Grails element is created, it is supplied with scaffolding, which can be used for two purposes:

  • Generate new elements:






  • Navigate through the existing ones:






IntelliJ IDEA features an easy way to run Grails targets: press Ctrl+Alt+G and specify the desired target in the Run Grails target dialog box. Note that code completion is available here: start typing the goal name, and press Ctrl+Space:











All output messages are sent to the console:










In the further posts, we’ll look deeper into Grails plugins management, building Grails applications, explore some Groovy and Grails subtleties, and more. Stay tuned.



Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}