Gradle Intellij Modules

I have a multi module/grails v3 plugin structure project.

Using `gradle idea` in the command line the project is imported almost correctly but then if I click 'refresh' in the gradle tool window the entire project is reloaded with each of the sources both main and test and grails-app folders being assigned their own module status. 

This makes searches, make/compile very annoying as the plugin folder now no longer has any sources assigned to it. I have to do each module one-by-one.

Before refresh

After refresh


ALso it would be really great if the grails console didnt start up after the gradle refresh as well. All I want to do is refresh the dependencies.


Hi Oliver

That's the new Gradle source-set support. IDEA creates separate module for each source-set. In Grails 3, there are 3 of them: main, test, integration-test. These modules will have proper relations between them, i.e. test module depends on main module.
Such approach helps to resolve various stuff properly.
You should rely on IDEA Gradle Import to work with Grails 3. 

Since IDEA 16 there will be no Grails modules. Grails application is represented within IDEA by its root only.

When Gradle import is finished, IDEA computes all Grails applications within your project.
IDEA needs some additional info from Grails, so it runs internal script, and collects its output, you can see it in Grails Console.
This info essentially is "which artefact inherits which traits". If you change build.gradle we cannot determine whether Grails plugin was added or it was just some regular dependency, so this script is executed after Gradle import/synchronize.
However IDEA will not run this script if build.gradle's CRC remains unchanged. 




Thanks for that clarification. It now makes sense.

However since updating to the 16 EAP public preview (IU-144.4199) the modules keep failing to identify dependencies linked to them. They are all listed correctly in the project settings view but every time I try to build or test or run i am getting errors stating 'package grails.core does not exist' and more, basically anything defined as a dependancy other than the core java including cross module (main -> test) dependencies. The only fix at the moment is to close the project and reopen it, even doing a 'gradle refresh' doesn't work. But by closing and reopening it seems to rerun the grails console and then works





Gradle refresh should help.
Could you please share your project privately?
Or at least I'd like to have a look to your build.gradle



Please sign in to leave a comment.