Skip Task if dependency not found

I need to run a task that depends on a file from an artifact repository, say

If the file isn’t present, the Task should be skipped (and the remainder of much build will continue, as sort of a “partial build”).

The following snippet downloads and caches the file as expected:

repositories {
    ivy {
        url ''
        patternLayout {
            artifact '/base/[organisation]/[module]/[revision]/[module]-[revision]-[classifier].[ext]'
        metadataSources { artifact() }

configurations {

dependencies {
    // Pattern: [organisation]:[module]:[revision]:[classifier]@[ext]
    myConf "org:myModule:1680:class@zip"

tasks.register('processFile') {
    def myConfClasspath = configurations.myConf.asPath
    doLast {
        println("####### ${myConfClasspath}")

But if the dependency doesn’t exist in the server, my build breaks right away.
I’m not finding a way to skip this processFile Task in this case. Is it possible at all?

If not, I think I’ll probably have to resort to exec+curl or ant.get, but I went for this approach first because in reality I’ll have a bunch of files to solve and this way sounded more “correct”.

EDIT: I should mention the source of my implementation: http - gradle - download and unzip file from url - Stack Overflow

If you declare a dependency and try to resolve that configuration, then the resolution must be successful, or the resolution fails.
You could use a lenient artifact view.
Lenient means that it does not right away fail if some of the dependencies cannot be resolved.
So you could then check whether there are files in the lenient artifact view, for example in an onlyIf { ... } action and use it to skip the task execution if the resolution failed.