[GRADLE-2899] Configuration-specific project dependencies not working with anonymous artifacts Created: 26/Sep/13  Updated: 07/Oct/13  Resolved: 06/Oct/13

Status: Resolved
Project: Gradle
Affects Version/s: None
Fix Version/s: 1.9-rc-1

Type: Bug
Reporter: Gradle Forums Assignee: Szczepan Faber
Resolution: Fixed Votes: 0

Known Issue Of:
1.7, 1.8

 Description   

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



 Comments   
Comment by Gradle Forums [ 26/Sep/13 ]

Sounds like a bug that was fixed in a 1.8 RC. Can you double-check that you still have this problem with 1.8 final?

Comment by Gradle Forums [ 26/Sep/13 ]

Yes, it's happening on 1.8 final... I also tried the latest night build, 1.9-20130925220417+0000, same problem there too.

Generated at Wed Jun 30 12:34:27 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.