I'm trying to do some Grails development using IDEA 13 EAP (133.609) on Windows 7. I bumped into something that may be an IDEA issue, or simply my not understanding how to use it properly.
For those not familiar with Grails (a truly wonderful web application platform!), a Grails project has a very specific directory structure. Different Grails artifacts go into different directories, but general purpose code not one of the Grails artrifacts goes under either the /src/groovy or /src/java folder, depending on whether it's Groovy or Java source.
I wanted to create a general purpose Groovy class in the package com.example. My natural inclination was to right click on the src/groovy folder in IDEA and choose New | Groovy Class. The only problem with that approach is, there is no such menu. There is an option for a New | Groovy Script, but a Groovy Script isn't really the same thing as a Groovy class.
I then right clicked on the src/java menu, and what do you know! There's a New | Groovy Class menu item available from a context menu on src/java. Thinking maybe the menu is just misconfigured and a Groovy class would actually get created under the src/groovy folder, I chose that New | Groovy Class option and entered com.example.Sample. Indeed, a Groovy class was created in the correct package, but the package and Groovy class was created in the src/java folder.
I'm thinking the New | Groovy Class menu is just being associated with the wrong folder (src/java instead of src/groovy). (Of course, the same misconfigured menu options are available from the main menu; i.e., with src/groovy selected there's no File | New | Groovy Class option, but with src/java selected there is.)
Since I'm not sure if Grails would have an issue with a Groovy class in the src/java folder, I manually moved the package and Groovy class to the src/groovy folder. I can continue to do this to work around IDEA, but am left wondering,
Is this a bug or a feature, or am I just doing something wrong? :-)
Thanks for any help.
PS. While experimenting, I also noticed the New | Groovy Class created a class properly, but the source generated for Interface, Enum, and Annotation types all included the public visibility modifier which is assumed in Groovy.