Skip root module in Idea project

(rainer.frey) #1

With the Idea plugin, is it possible to skip generating a root module in a multi-project-build? I want to generate one Idea project with all subprojects as modules, but no module for the root project (which has no content on its own)?

(Peter Niederwieser) #2

Try something like this (for the root project):

generateIdeaModule.enabled = false

(rainer.frey) #3

Thanks, that prevents generating the module file. FTR, correct task name is:

ideaModule.enabled = false

But the project file still contains a reference to the (now missing) module. What exactly does the IdeaProject.modules property contain? Is it possible to remove a default module from it, e.g. with -=? What kind of object would I need to use as argument? TA file object for the module file? a String with the module name? Or?

(Peter Niederwieser) #4

Please see the Gradle Build Language Reference. You’ll have to defer setting ‘ideaProject.modules’ with something like ‘gradle.projectsEvaluated { … }’.

(rainer.frey) #5

Great, that works! Full solution:

gradle.projectsEvaluated {
 gradle.rootProject {
     ideaModule.enabled = false
  idea {
   project {
    modules = subprojects*.idea.module