Good morning, Gradle Masters. Any ideas why during...
# gradle
a
Good morning, Gradle Masters. Any ideas why during project build gradle does not throw/fail with an Exception? I am getting the
should throw
printed in build logs, but for some reason it is BUILD SUCCESSFUL
Copy code
project.configurations.all {
    resolutionStrategy.eachDependency {
        if (this.requested.name.contains("abc")) {
            println("should throw")
            throw IllegalArgumentException("Can not use abc dependency ")
        }
    }
}
d
IIRC substitutions are tolerant of exceptions in some cases - you’re probably after one of these https://docs.gradle.org/current/userguide/rich_versions.html#rich-version-constraints
a
@danny Either me or 3-rd party libraries I use does not have dependency on
Log4j
Also, I am not trying to execute substitution of dependency. Instead I want to fail a build if dependency has a restricted group/name/you_ (including 3-rd party libraries)