I have a multi-project setting in my Android project:
- android
- app
- lib1
- util
In util
I defined a configuration:
task createTestJar(type: Jar) {
classifier = 'test'
from "$projectDir/build/intermediates/classes/test/debug"
}
configurations {
archives
archives.transitive = true
}
artifacts {
archives createTestJar
}
And I tried to reference it in lib1
:
// doesn't work
testCompile project(path: ':utils', configuration: 'archives')
// says can't find 'archives' in configuration container
testCompile project(':utils').configurations.archives.artifacts.files
// works if i manually create the jar beforehand
testCompile fileTree(dir: "$rootDir/utils/build/libs", include: ['*.jar'])
I tried to print out what configurations my util
module has in lib1
:
project(':shared-utils').configurations.forEach {
println("${it.name}")
}
And I get empty result. When I print it in my util
module I can see a long list, with my archives
config in it.
Any idea why this happens? I heard there’s some default tasks that comes with the java
plugin which android doesn’t have? BTW both lib1
and util
has these plugins applied:
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
Thanks in advance!!