如何在 SBT 0.10 中声明项目依赖?
我使用 SBT 0.10.0
。
如何下载/检索项目依赖项?
例如,对于 slf4s 仅提及这一行:
val slf4s = "com.weiglewilczek.slf4s" %% "slf4s" % "1.0.6
Where do I need to put this line, and how do我得到图书馆?
I use SBT 0.10.0
.
How do I download/retrieve project dependencies?
For example, for slf4s only this line is mentioned:
val slf4s = "com.weiglewilczek.slf4s" %% "slf4s" % "1.0.6
Where do I need to put this line, and how do I get the library?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我假设您使用的是 SBT 0.10.0,因为早期版本会自动将您的 deps 放入
lib_management
中。在
build.sbt
中,添加以下行:I presume you're using SBT 0.10.0, because earlier versions will put your deps in
lib_managed
automatically.In
build.sbt
, put the following line:您在项目中创建一个
project/build
子目录,并在其中放置一个包含上述内容的 scala 文件。然后,当您从项目根目录启动 sbt 时,该
命令将检索您的依赖项。
请注意,默认情况下它只会分析您的项目配置一次。如果你改变它,你必须调用
reload
更新:
让项目类扩展DefaultProject:
You create a
project/build
subdirectory in your project and put a scala file with the above content there.Then when you start sbt from your project root directory the
command will retrieve your dependencies.
Note that it will only analyse your project configuration once by default. If you change it, you have to call
reload
UPDATE:
let the project class extend DefaultProject:
不知道你用的是哪个版本的sbt。
对于 0.10,Daniel C. Sobral 发表了一篇关于创建 sbt 项目的博客文章:
dcsobral-project-creation-guide
也许这有帮助。
I don't know which version of sbt you are using.
For 0.10, Daniel C. Sobral made a blog post about creation of an sbt project:
dcsobral-project-creation-guide
Maybe this helps.