I have two Gradle projects, let's call them Blue and Green. Green depends on Blue, as declared in its build.gradle
:
repositories {
mavenLocal()
}
dependencies {
compile 'org.example:blue:1.0'
}
Blue uses the Maven plugin to build the appropriate artifact:
apply plugin: 'maven'
group = 'org.example'
version = '1.0'
If I run the install
task on Blue, it creates a JAR and a POM and puts them in my ~/.m2/repository
, no problem.
I import Blue's build.gradle
into my IDEA project, and it creates a module for Blue, again no problem.
If I now import Green's build.gradle
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.
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.
How can I get IDEA to recognize the interdependencies between my Gradle projects and their corresponding IDEA modules?
Edited to add: 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.
Edited to add: For a pointer to what I eventually came up with, see this answer. 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.