[GRADLE-2921] Adding dependencies to extended configuration does not error if extending configuration has already been resolved Created: 14/Oct/13  Updated: 28/Aug/14  Resolved: 25/Aug/14

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

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

Issue Links:
Duplicates GRADLE-3155 changes to configuration hierarchy af... Resolved


Consider this example:

configurations {
runtime {
extendsFrom compile

configurations.runtime.files.each {
println it.name

dependencies {
runtime group:'org.gradle', name:'gradle-core', version:'1.0'

This does the correct thing, it will error, informing the user "You can't change a configuration which is not in unresolved state!"
However, if we change the last 3 lines to this:

dependencies {
compile group:'org.gradle', name:'gradle-core', version:'1.0'

This doesn't error. I argue this should, since this should attempt to implicitly change the runtime configuration which is not in an unresolved state. The lack of an error makes it very hard to track down bugs related to altering configurations in tasks to be used later on in the build, a very useful feature of gradles configuration model.

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