Intellij does not show autocompletion for groovy methods - grails

So, i have intllij 2016.1.3 (professional)
I imported an existing grails 2.5 project, created a grails 2.5 library by pointing to grails installation. Every thing seem to work, other then the suggestions for groovy methods (eg default groovy methods collect, find, sort, eachWithIndex etc). Intellij does not show suggestions for this groovy methods, and does not even recognize it, even if i manually write the method name. Surprizingly it shows suggestions for collectParallel, eachParallel.
Tried setting up a groovy library, used groovy-eclipse compiler, but not luck.
What could be going wrong?

The solution was to remove dslActivationStatus.xml from ~/Library/Preferences/<IntellijVersion>/options/ (OSX El capitan)
This was suggested by intellij support team after investigating it for few days.

Related

custom codec not found in plugin

I have a grails application with multiple internally developed plugins. Since upgrading from 4.x to 5.2.3, codecs are not found in one plugin, but are found in others. Specifically, I can place the same file (UsernameListCodec.groovy, package name changed from one plugin to the next but otherwise no changes) in grails-app/utils in one plugin and it works; when placed in grails-app/utils in another plugin it fails with MissingMethodException.
What could cause this? The plugins are fairly different in terms of what they provide, but very similar in terms of how they're built, published, etc. Clearly this is something I'm doing wrong (since the codec works in another plugin) but I don't even know where to begin looking. Does a plugin need to do something in particular to be able to provide custom codecs as of grails 5?

How to create a CLI script for code generation, like what "grails create-controller" does

I would like to create a command line tool to generate some java source code...e.g., a controller class, service class, and a DTO class. I've been trying to find the scripts for CreateController.groovy (from grails), but I've had no luck finding that script. Any help would be much appreciated. I think it might be done with Gant?
I've been trying to find the scripts for CreateController.groovy
(from grails), but I've had no luck finding that script.
You haven't indicated what version of Grails you want to use and that may be relevant. For recent versions of Grails there is not a CreateController.groovy but the create-controller command is defined at https://github.com/grails/grails-profile-repository/blob/master/profiles/web/commands/create-controller.yml.
I think it might be done with Gant?
Not since Grails 2. If you are using Grails 1 or 2, then a Gant script might be what you are looking for. For Grails 2.5.6, the command is defined at https://github.com/grails/grails-core/blob/bd7cc10e17d34f20cedce979724f0e3bacd4cdb4/grails-scripts/src/main/scripts/CreateController.groovy.

Changing Grails SDK in IntelliJ IDEA Doesn't Work on Plugin Modules

IDEA 11.1.2
I have a Grails app I need to upgrade. The application consists of several modules. One being the application and a few others being plugins. I right clicked on the application and went to Grails -> Change SDK Version. I chose the version I wanted, then IDEA asked me if I wanted to upgrade the application. Clicked yes and all was good.
I've been trying to do the same thing on the plugin modules. IDEA never asks if I want to upgrade and it doesn't appear to change the SDK. If I upgrade the modules from the command line, when I come back to IDEA, it thinks there is a version mismatch and automatically downgrades me without even asking.
Is there a workaround for this?
It worked for me in this IDEA version. Make sure that you change Grails version in application.properties of all plugins:
app.grails.version=2.1.0
Then right-click on every module (plugin), Grails, Change SDK version. It should be changed already.
Have exactly same problem - app + plugins wich requires different SDK (for testing).
After some investigation found that it's an IntelliJ IDEA bug IDEA-114418. So, I think, it will be good if you'll vote for this bug there too.
I also had the same bug. I took extreme measures to rectify it.
I deleted the old grails from the Global Libraries. Go to file>Project Structure > Global Libraries . It should complain that this is used by a module.
Then I had to add grails framework support, but added the new one.

Grails Auto-format Line wrap

I was trying to using Crtl+shift+F to format a groovy class in springsource suite tool. However, it doesn't split lines that are very long (more than 80 characters) as it does with java files.
I would appreciate if anybody could recommend me a tool for perform wrapping of lines in groovy files and generally grails projects.
Thanks in advance.
IntelliJ does a very nice job of formatting Groovy code. The free version of IntelliJ includes Groovy support, but not Grails support (last time I checked)
What version of STS are you using? We have recently fixed a few issues regarding formatting of Groovy code in the latest release of Groovy-Eclipse (2.1.1). The update site is here:
http://dist.springsource.org/release/GRECLIPSE/e3.6/
This should solve your problem, but if it doesn't, then I'd suggest raising a bug on the issue tracker:
http://jira.codehaus.org/browse/GRECLIPSE

Command to change package name in Grails

I have created my application under package music. Now I want to change my package to com.mp3.songs.music.
One way is I can manually create the package for grails-app. Is there anything else that I need to take care while changing the package name.
Alternatively, is there a command in grails which can be used to change the package.
I found a way out in the below link. But this works only when you create new files. What if you want to change the package of the older files.
http://www.goto20.nl/tech/groovy/configuring-the-default-package-name-for-a-grails-project/
Thanks!
IntelliJ IDEA has very good support for rename refactoring. I believe it is currently the best (9.0.3 stable) chance you'll have of any major refactoring jobs in Grails. They have a 30 day trial, so it is worth a try.
Why not use Spring Source Tool Suite. Its a great IDE with solid support for Groovy n Grails.

Resources