title: Getting Intellij IDEA (13+) to recognize Gradle module interdependencies
body: <p>I have two Gradle projects, let's call them Blue and Green. Green depends on Blue, as declared in its <code>build.gradle</code>:</p>
  
  <pre><code>repositories {
    mavenLocal()
  }
  
  dependencies {
      compile 'org.example:blue:1.0'
  }
  </code></pre>
  
  <p>Blue uses the Maven plugin to build the appropriate artifact:</p>
  
  <pre><code>apply plugin: 'maven'
  group = 'org.example'
  version = '1.0'
  </code></pre>
  
  <p>If I run the <code>install</code> task on Blue, it creates a JAR and a POM and puts them in my <code>~/.m2/repository</code>, no problem.</p>
  
  <p>I import Blue's <code>build.gradle</code> into my IDEA project, and it creates a module for Blue, again no problem.</p>
  
  <p>If I now import Green's <code>build.gradle</code> into my IDEA project, it creates a module for Green, picks up the Mavenized version of Blue from the repository, creates a corresponding library, and adds the Blue library to the Green module as a dependency.</p>
  
  <p>However, if I now make a code change in Blue, that code change isn't picked up in Green. Green is going to continue to use the now-stale copy from the Maven repository. The only way to get the Blue changes is to re-install Blue, and as for refactoring something in Blue and having the refactoring cover the usages in Green, forget about it. Problem.</p>
  
  <p>How can I get IDEA to recognize the interdependencies between my Gradle projects and their corresponding IDEA modules?</p>
  
  <hr>
  
  <p><strong>Edited to add:</strong> Multi-module isn't really an option because the dependencies in question are shared between multiple application projects (not to mention other shared-library projects) and don't fit neatly into a single hierarchical directory structure.</p>
  
  <hr>
  
  <p><strong>Edited to add:</strong> For a pointer to what I eventually came up with, see <a href="https://stackoverflow.com/a/23574904/27358">this answer</a>. It still requires manually creating multi-module projects when you want to work on both a project and its dependencies, but it lets you swap source and binary dependencies in and out more or less freely.</p>