I’m trying to make a project dependency that fits our directory structure setup, but I’m getting problems when gradle tries to resolve the libraries for compiling.
My setup is as follows:
ProjectA/
Base/
build.gradle:
repositories {
println "ProjectA.Base, pwd = ${new File('.').canonicalPath}"
flatDir dirs: 'lib'
}
dependencies {
compile ':mylib'
}
ProjectB/
Base/
settings.gradle:
include "ProjectA.Base"
project (':ProjectA.Base').projectDir = file('../../ProjectA/Base')
build.gradle:
dependencies {
compile project(':ProjectA.Base')
}
I can compile ProjectA fine from within itself, but when I try to build ProjectB I’m getting the error:
ProjectA.Base, pwd = /path/to/ProjectB/Base
:compileJava
FAILURE: Build failed with an exception.
* What went wrong:
Could not resolve all dependencies for configuration ':compile'.
> Could not find group:, module:mylib, version:
Required by:
:Base:unspecified > Base:ProjectA.Base:unspecified
so it seems when ProjectA is getting loaded as part of ProjectB’s compile phase, it’s trying to resolve them relative to ProjectB’s directory, not the dependant project.
How can i fix this? We don’t use repositories anywhere, it’s all flatDir loading, and all libraries are in the “lib” dir of the appropriate project.
Thanks for any help. Mark