I have a project ‘a’ that declares two artifacts, each to its own configuration.Another project ‘b’ has two configurations, each depending on one of the configurations from ‘a’. When the configuration is resolved, both of the ‘b’ configurations wind up pointing to the same configuration of ‘a’. This started happening in gradle 1.7 and is also in 1.8. In version 1.6, they resolved to different files.
Project ‘a’:
configurations {
configA1
configA2
}
task A1jar(type: Jar) {
archiveName = 'A1.jar'
destinationDir = file("build/tmplibs")
}
task A2jar(type: Jar) {
archiveName = 'A2.jar'
destinationDir = file("build/tmplibs")
}
artifacts {
configA1 A1jar
configA2 A2jar
}
Project ‘b’:
configurations {
configB1
configB2
}
dependencies {
configB1 project(path:':a', configuration:'configA1')
configB2 project(path:':a', configuration:'configA2')
}
task dumpConfig << {
println configurations.configB1.files
println configurations.configB2.files
}
So I’m expecting output like this (which is what Gradle 1.6 does)
:b:dumpConfig
[/home/aelliott/tmp/projectbug/a/build/tmplibs/A1.jar]
[/home/aelliott/tmp/projectbug/a/build/tmplibs/A2.jar]
But instead 1.7 and 1.8 both print
:b:dumpConfig
[/home/aelliott/tmp/projectbug/a/build/tmplibs/A2.jar]
[/home/aelliott/tmp/projectbug/a/build/tmplibs/A2.jar]
The real-world scripts I have fail because these configurations are used to compile java code, and the classpath becomes incorrect.
Is this a bug, or were we using the artifacts incorrectly before? Thanks,
-Adam