Over a million developers have joined DZone.

Easy Grails with IntelliJ IDEA

· Java Zone

Bitbucket is for the code that takes us to Mars, decodes the human genome, or drives your next car. What will your code do? Get started with Bitbucket today, it's free.

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.


Bitbucket is the Git solution for professional teams who code with a purpose, not just as a hobby. Get started today, it's free.


Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}