Resolving dependencies shall not fail in the case of unresolvable dependencies

Hello,

I have a configuration with unresolvable dependencies and I would like just to print out the unresolvable once. The build itself shall not fail. According to the API the lenientConfiguration should be used to achieve that. I wrote following piece of code:

def configuration = getConfigurations().getByName('compile')
def resolvedConfiguration = configuration.getResolvedConfiguration()
resolvedConfiguration.getLenientConfiguration().unresolvedModuleDependencies.each() {
  println "ERROR: $it.selector ($it.problem)"
}

The build fails with exception in the second line of code. What did I wrong? (I am using gradle 2.1)

Kind Regards Markus

What exception are you getting?

In general, you might have better results using the newer ‘ResolutionResult’ API. http://www.gradle.org/docs/current/dsl/org.gradle.api.artifacts.Configuration.html#org.gradle.api.ar…