scala 如何在 SBT 中刷新更新的 Git 依赖项?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8864317/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I refresh updated Git dependency artifacts in SBT?
提问by Alex Dean
I've configured SBT (0.11.0) to pull in a GitHub project as a dependency, as per my answer on this question here.
根据我在此问题上的回答,我已将 SBT (0.11.0) 配置为将 GitHub 项目作为依赖项引入。
It works fine except that I can't seem to get SBT to re-compile my Git dependency when it gets updated. In other words: if I make an update to the dependency, push to Git and reload my project's SBT and run package, then SBT does not recompile the external Git dependency when compiling my project.
它工作正常,只是我似乎无法在更新时让 SBT 重新编译我的 Git 依赖项。换句话说:如果我更新依赖项,推送到 Git 并重新加载我项目的 SBT 并运行package,那么 SBT 在编译我的项目时不会重新编译外部 Git 依赖项。
I've tried creating a new branch in my Git dependency (say, forcenew) and updating the branch in my SBT project configuration to use this:
我已经尝试在我的 Git 依赖项中创建一个新分支(比如,forcenew)并更新我的 SBT 项目配置中的分支以使用它:
lazy val depProject = RootProject(uri("git://github.com/me/dep-project.git#forcenew"))
But even this doesn't force a refresh. I'm a bit stumped - I can't even find where SBT puts the Git project to compile it (it doesn't seem to be in ~/.sbt/or ~/.ivy2/)...
但即使这样也不会强制刷新。我有点难住 - 我什至找不到 SBT 将 Git 项目放在何处来编译它(它似乎不在~/.sbt/或中~/.ivy2/)...
Any help greatly appreciated!
非常感谢任何帮助!
采纳答案by Somatik
From: https://github.com/sbt/sbt/issues/335
来自:https: //github.com/sbt/sbt/issues/335
this should be fixed in 0.12.0, just call "sbt update"
这应该在 0.12.0 中修复,只需调用“sbt update”
It was fixed in 0.12.0 so sbt updateis enough, but got back in 13.0-- for now, you have to wipe dependency from ~/.sbt/staging/manually
它已在 0.12.0 中修复,所以sbt update就足够了,但是在 13.0 中又恢复了——现在,您必须~/.sbt/staging/手动清除依赖项
回答by Adam Klein
You likely want to clear out ~/.sbt/staging/
你可能想清除 ~/.sbt/staging/
回答by Destry
A quick hack you can add to your build.sbt:
您可以添加到 build.sbt 的快速技巧:
def removegit = Command.command("removegit"){state =>
val home = sys.env("HOME")
val k = ("rm -rf "+ home + "/.sbt/0.13/staging/").!
state
}
commands ++= Seq(removegit)
And then sbt removegitwill wipe that directory. This doesn't do anything smart like checking commits, which would be a great upgrade... The repos are being stored in ~/.sbt/0.13/staging/on my machine, you may need to adjust that.
然后sbt removegit将擦除该目录。这不会像检查提交那样做任何聪明的事情,这将是一个很好的升级......回购正在存储在~/.sbt/0.13/staging/我的机器上,您可能需要调整它。

