I have a dependency problem and I do not know how to solve it.
I have a project A, B and C.
A needs B and C
B needs C
My directory structure looks like this:
A
|-settings.gradle
|-build.gradle
|-lib
|- B
|- C
settings.gradle content:
include 'lib/B'
include 'lib/C'
build.gradle content:
apply plugin: 'java'
dependencies {
compile project(':lib/B'),
project(':lib/C')
}
project(':lib/B'){
dependencies {
compile project(':lib/C')
}
}
If I do NOT declare the project(':lib/B'){...} part, project B can not be build because of dependencies.
If I declare the project(':lib/B'){...} part, Gradle tells me : Could not find method compile() for arguments [project ':lib/C'] on org.gradle.api.internal.artifacts.dsl.pendencies.DefaultDependencyHandler_Decorated@221bad.
How am I able to solve it, or compile C before B?
PS: Data structure changes are not possible.
Please, try to add
subprojects {
apply plugin: 'java'
}
to your main build.gradle