Depencies between subprojects with idea plugin

Hi there,

I am using Gradle 2.7. I have a multi-project setup with dependencies between subprojects, like this:

project(':projectA') {
  dependencies {
    compile project(':projectB')
}

When I use the idea plugin I assumed that those dependencies would also be written to the *.iml files, but they are not. I then added to the build file something similar to:

  idea {
    module {
      iml {
        whenMerged { module ->
          module.dependencies += new org.gradle.plugins.ide.idea.model.ModuleDependency('projectB','compile')
        }
      }
    }
  }

But this feels like a hack. Why aren’t these dependencies generated when one project depends on another?

Thanks!

Did you add the projects to settings.gradle. Project dependencies are automatically established when generating project files with the idea plugin.

Yes, all subprojects are included by the top-level settings.gradle file.