Gradle非托管远程依赖项

Gradle非托管远程依赖项

本文介绍了Gradle非托管远程依赖项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个驻留在远程服务器上的 jar 依赖关系。我如何解决在Gradle中?似乎没有办法为远程文件,只有本地文件定义存储库,而且我也是这样的,似乎也不工作:

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.

有什么想法?

Any ideas?

推荐答案

不幸的是,根据目前不支持远程共享。
但是,这可以通过执行以下操作轻松解决:

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


  1. 复制将在本地复制远程JAR。此类代码的可能位置可以是存储库配置,以确保在解决依赖关系之前将文件复制。

  2. 定义指向jars本地位置的本地存储库。 / li>
  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.

这篇关于Gradle非托管远程依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 12:53