Hey! >throws an exception if a dependency cannot be resolved.
getResolvedConfiguration() should not throw an exception if some dependency cannot be resolved. It is, however, thrown when you try to access artifacts via getResolvedArtifacts() Not sure what's the deal with try/catch issue, never heard about such problem. Take a look at getResolvedConfiguration().getLenientConfiguration() method - might be useful for your use case :) Cheers! On Wed, Sep 4, 2013 at 11:55 PM, Alex Ruiz <alr...@google.com> wrote: > We tried this with Gradle 1.6 and 1.8. > > > On Wed, Sep 4, 2013 at 2:54 PM, Alex Ruiz <alr...@google.com> wrote: > >> Greetings, >> >> We are making changes in the Android Gradle plug-in to allow project >> import continue even if dependencies are not being resolved. From a stack >> trace we found that the method: >> >> org.gradle.api.artifacts.Configuration.getResolvedConfiguation() >> >> throws an exception if a dependency cannot be resolved. So, I try to put >> that line of code in a try/catch block, in its own method, like this (this >> is inside a Groovy class, BTW): >> >> static Set<ResolvedArtifact> getResolvedArtifacts(Configuration >> configuration) { >> try { >> return >> configuration.getResolvedConfiguration().getResolvedArtifacts(); >> } catch (Throwable t) { >> return new HashSet<ResolvedArtifact>(); >> } >> } >> >> The problem is that, even there is a try/catch block, the exception is >> being thrown anyway and never caught! >> >> Xav reported a similar issue, but he was able to work around it by moving >> code to Java. We tried the same thing, we moved the method to a Java class, >> and the exception is still not being caught! >> >> This is so weird (probably Groovy magic?) >> >> Is there a way to get around this? >> >> Many thanks, >> -Alex >> >> >> > -- Szczepan Faber core dev@gradle; lead@mockito Join me at the Gradle eXchange 2013, Oct 28th in London: http://skillsmatter.com/event/java-jee/gradle-exchange-2013