Reputation: 1256
I have a project like this:
In the root build.gralde I am defining 3rd party dependencies needed by all submodules. However, in intellij the submodules don't seem to recognize the dependencies and won't compile. I've seen this work in the past and can't figure out what I'm doing wrong
Root build.gradle plugins { id 'java' }
group 'com.XXX'
version '1.0-SNAPSHOT'
sourceCompatibility = 1.8
allprojects {
repositories {
mavenLocal()
mavenCentral()
jcenter()
}
}
dependencies {
...
}
settings.gradle
rootProject.name = 'XXX'
include 'module1'
include 'module2'
module1 build.gradle
plugins {
id 'java'
}
group 'com.XXX'
version '1.0-SNAPSHOT'
sourceCompatibility = 1.8
Upvotes: 0
Views: 872
Reputation: 1256
I realized I just needed to put the dependencies in the root build.gradle within a "subprojects" block and add the java plugin as well.
subprojects {
apply plugin: 'java'
dependencies {
...
}
}
Upvotes: 1