SBT能否刷新git uri的依赖(总是或按需)?

我有以下sbt代码在git uri上添加插件依赖项:

import sbt._

object Plugins extends Build {
  lazy val username = ("git config --global user.bitbucket" !!).trim

  lazy val root = Project("root", file(".")) dependsOn(
    uri(s"https://$username@git-repo.org/team/build.git#build_0.1")
  )
}

这工作正常,但我发现,如果我对build_0.1进行了更改并将其推入,当我再次compile该项目时,sbt不会提取我所做的更改,因此我拥有一个过时的插件。

我怎样才能让SBT总是对它所依赖的依赖进行git pull?


SBT高达0.13.2-M1只支持git clonegit checkout

当URL不包含#指向分支或提交时使用git clone ,例如

git:file:///Users/jacek/sandbox/so/sbt-git/git-repo

git checkout时,URL具有执行#在指向在分支机构或承诺,例如URL

git:file:///Users/jacek/sandbox/so/sbt-git/git-repo/#a221379c7f82e5cc089cbf9347d473ef58255bb2

当我commit 'git repo更改时,我必须更新build.sbt的提交哈希,以便在SBT项目中引用更改(下面的val v )。

lazy val v = "a221379c7f82e5cc089cbf9347d473ef58255bb2"

lazy val g = RootProject(uri(s"git:file:///Users/jacek/sandbox/so/sbt-git/git-repo/#$v"))

lazy val root = project in file(".") dependsOn g

随着git存储库的变化,SBT项目必须reload ,以便可以运行新的结帐并刷新项目。

[root]> reload
[info] Loading global plugins from /Users/jacek/.sbt/0.13/plugins
[info] Loading project definition from /Users/jacek/sandbox/so/sbt-git/project
Cloning into '/Users/jacek/.sbt/0.13/staging/24535507588417c1c2dc/git-repo'...
Checking connectivity... done
[info] Set current project to root (in build file:/Users/jacek/sandbox/so/sbt-git/)
[root]>

这是很痛苦的,但是诀窍在于(并让你跟踪远程git仓库的位置)。

你也可能会发现GIT的多项目可以用作SBT依赖项吗? 有用。

链接地址: http://www.djcxy.com/p/76949.html

上一篇: Can SBT refresh git uri dependency (always or on demand)?

下一篇: Create a JAR containing classes and resources from webapp using Gradle