Use apply from in buildscript block with multiple urls


(Nikolaus Krismer) #1

Hi,

one of my buildfiles includes a buildscript block that references another buildfile using the apply from rule:

buildscript {
    apply from: 'http://www.myserver.com/mybuildfile.gradle'
}

However, the server is not very stable and so my build fails every time it is not reachable.

I was wondering, if there is some way to do the following (I haven’t tested this)

buildscript {
    apply from: ['http://www.myserver.com/mybuildfile.gradle', 'http://www.myotherserver.com/mybuildfile.gradle']
}

What I would now expect from gradle is that it uses the first build file it can actually download (or maybe even the one which can be downloaded at best speeds - something like yum’s fastestmirror plugin) and that it only fails if all servers are not reachable.

Is something like this possible? I was even thinking about something like a url-shortener that handles this task, but I could not find anything.

Cheers,
Niko