1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-12-23 02:58:00 +01:00

build.gradle: Do not resolve runtime configuration to early

as it would cause "Cannot change dependencies of configuration after
it has been included in dependency resolution" errors with Gradle >=
3.

Thanks to James Justinic for pointing this out.
This commit is contained in:
Florian Schmaus 2017-07-03 10:29:57 +02:00
parent 3a79566f1c
commit 80b6e30196

View file

@ -245,7 +245,13 @@ task distributionZip(type: Zip, dependsOn: [javadocAll, prepareReleasedocs, mark
task maybeCheckForSnapshotDependencies { task maybeCheckForSnapshotDependencies {
// Don't check for Snapshot dependencies if this is a snapshot. // Don't check for Snapshot dependencies if this is a snapshot.
if (isSnapshot) return onlyIf { isReleaseVersion }
// Run in the execution phase, not in configuration phase, as the
// 'each' forces the runtime configuration to be resovled, which
// causes "Cannot change dependencies of configuration after it
// has been included in dependency resolution." errors.
// See https://discuss.gradle.org/t/23153
doLast {
allprojects { project -> allprojects { project ->
project.configurations.runtime.each { project.configurations.runtime.each {
if (it.toString().contains("-SNAPSHOT")) if (it.toString().contains("-SNAPSHOT"))
@ -253,6 +259,7 @@ task maybeCheckForSnapshotDependencies {
} }
} }
} }
}
test { dependsOn maybeCheckForSnapshotDependencies } test { dependsOn maybeCheckForSnapshotDependencies }