Plain URL dependencies


(Punyashloka Biswal) #1

What’s the best way to have a Gradle build depend on a file downloaded from a plain http URL? This is a file that isn’t part of an Ivy/Maven repository, though it does have a version number in its path and can be cached.

(I’ve tried using de.undercouch.download as well as invoking the ant get task, but neither of those caches the downloaded file across builds.)


(davidmichaelkarr) #2

I think what you need to do is specify this URL as a repository and specify a normal dependency. I haven’t done this, but from what I just read, it seems like if you specify this as a “maven” repository, even though it doesn’t have a POM descriptor, it should find the jar.

I found an old thread that seems to be relevant.


(René Groeschke) #3

I would go with a ivy repository and a custom url pattern you need to
configure. have a look at the according chapter in the gradle userguide
at
http://gradle.org/docs/current/userguide/userguide_single.html#ivyRepository


(Punyashloka Biswal) #4

Thanks for your advice, @Rene and @David_Karr! I was able to add an Ivy repository containing my dependency.


(Vic Seedoubleyew) #5

For those that will later stumble across this :

  • here is a good answer that explains how to define the pattern of the ivy repository
  • the gradle-download-task plugin works well, and you can manually add the caching mechanism by copy-pasting that code. Most probably, soon it will include the caching mechanism by default