Changing flag of dependencies does not work if a classifier if set

We use the follow code to disable the dependency cache and load a dependency with classifier. But we receive ever an old version from the cache.

configurations.all {
    resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
dependencies {
    compile group: 'foo', name: 'bar', version: '2.2', ext: 'jar', changing: true, classifier: 'vanilla'
}

Without a classifier it work. We use an ivy repository. The Gradle version is 2.4.

A workaround is to add the follow line:

gradle.startParameter.refreshDependencies = true

Rather than setting the ‘changing’ flag on the dependency, you could try using a “Component Metadata Rule” to specify that the module in question is changing. This is much more flexible, because it applies to transitive dependencies, and should work with classifiers as well:

https://docs.gradle.org/current/dsl/org.gradle.api.artifacts.dsl.ComponentMetadataHandler.html