sbt 如何从 git 中提取依赖项? [英] How can sbt pull dependency artifacts from git?
问题描述
我听说(而且我知道我也看过例子,如果我能记得在哪里的话)sbt
可以从 git 存储库中获取依赖项.
I've heard (and I know I've seen examples too, if only I can remember where) that sbt
can obtain dependencies from a git repo.
我希望从 github 获取依赖项 harrah/up.存储库不提供任何工件 JAR 文件,仅提供使用 sbt
构建的源树.我想象的过程是 sbt
将下载源代码库,构建它,然后将其用作依赖项.
I am looking to obtain the dependency harrah/up from github. The repository does not provide any artifact JAR files, only a source tree which is set up to be built using sbt
. The process that I am imagining is that sbt
will download the source repo, build it, and then use that as the dependency artifact.
我可能在想象 sbt
实际上可以做这样的事情.它可以?如果是这样,如何?
I may be imagining that sbt
can in fact do something like this. Can it? And if so, how?
推荐答案
确实如此.您可以使用 dependsOn
运算符为您的 Project
提供依赖项,并且您可以通过其 URI 引用 Github 项目,例如 RootProject(uri("git://github.com/dragos/dupcheck.git"))
.或者,您可以 git clone
项目,然后使用 RootProject(file(...))
引用您的本地副本.有关详细信息和示例,请参阅 SBT wiki 上的完整配置".
Yes indeed. You can give your Project
a dependency with the dependsOn
operator, and you can reference a Github project by its URI, for example RootProject(uri("git://github.com/dragos/dupcheck.git"))
. Alternatively, you can git clone
the project, and then reference your local copy with RootProject(file(...))
. See "Full Configuration" on the SBT wiki for details and examples.
这篇关于sbt 如何从 git 中提取依赖项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!