0

I have a jar dependency that resides on a remote server. How do I resolve that in Gradle? There doesn't seem to be a way to define a repository for remote files, only local files, and I'm something like this doesn't seem to work either:

compile("group:name:version") {
  artifact {
    url = "http://server/dep.jar"
  }
}

The docs seems to hint that something like this should be possible, but so far I'm unable to find an example anywhere.

Support for non-managed dependencies: If your dependencies are simply files in version control or a shared drive, Gradle provides powerful functionality to support this.

Any ideas?

JasonMArcher
  • 14,195
  • 22
  • 56
  • 52
nilskp
  • 3,097
  • 1
  • 30
  • 34
  • Maybe you can define a *custom maven repository* as in this question + answer: http://stackoverflow.com/questions/28754898/is-it-possible-to-include-angularjs-to-a-project-with-gradle and resolve the artifact that way. – Opal Mar 13 '15 at 05:49

1 Answers1

1

Unfortunately, according to gradle documentation a remote share is currently not supported. However, this can be worked-around easily by doing the following:

  1. Copy that will copy the remote jars locally. A possible location for such code can be the repositories configuration to ensure that the files will be copied before the dependencies will get resolved.
  2. Define a local repository pointing to the local location of jars.
Amnon Shochot
  • 8,998
  • 4
  • 24
  • 30
  • Do you have an example of how to download? Presumably after that, I can just use a `flatDir` repo? – nilskp Mar 13 '15 at 01:27