"You can't change a configuration which is not in unresolved state!" Exception since MST9

Hey out there,

I want to update to mst9. I installed the new gradle version and got some strange exceptions:

I get “You can’t change a configuration which is not in unresolved state!” to buildscript evaluate time. The line which gradle error output calls, contains only "apply plugin: ‘war’ "

When I remark this line I’ll get another corrupt build.gradle in another submodule called from gradles error output. This line contains: “runtime group: ‘myRepoModule’, name: ‘myLib’, version: '5.5.5”

Could somebody help, post an idea, could reproduce!?!?!

Best regards,

Pascal Stieber

Can you post your full build script?

that won’t be possible, but i’ll try to give an representative example.

apply plugin: 'war'
  version = '1.0-SNAPSHOT'
  dependencies {
    compile project(':otherProject')
    runtime group: 'myModule', name: 'myLib', version: '5.5.5'
}
  task myJar(type: Jar) {
    classifier = 'class'
       from (sourceSets.main.output.classesDir) {
        include (
 //some files/dirs
         )
    }
}
  war {
    classpath = []
    webInf {
        into ('classes') {
            from (sourceSets.main.output.classesDir){
                include "dir/to/myClass.class"
            }
            from (sourceSets.main.output.resourcesDir){
                include "myProperty.properties"
            }
        }
    }
    archiveName = 'myWar.war'
    manifest {
        afterEvaluate {
            def warManifestClasspath = []
            jars = (configurations.runtime + fileTree("build/libs")).each { File f ->
                warManifestClasspath << (f.name.endsWith('-classif.jar'))
            }
            attributes (
               //some attributes
            )
            }
       }
}
  artifacts {
    archives (
        myJar,
        war
    )
}

Hope that’s good enough!!!

Thanks in advanced and greetings!

That’s not quite enough to pinpoint it exactly, but I can get a general idea.

As soon as you ask a configuration for its files, it resolves and becomes locked. My guess would be that you are triggering the resolution of a child project’s configurations from the parent build (or anywhere higher up).

It’s going to be impossible to pinpoint the exact cause without a reproducible sample unfortunately.