sbt Build.scala 上的库依赖性带有子项目的完整配置
我有一个项目 foo 有两个孩子 foo-core 和 foo-cli,foo-cli 依赖于 foo-core (我来自 Java/Maven,并尝试将父模块转置为 2 个子模块架构)。 遵循https://github.com/harrah/xsbt/wiki/Full-Configuration,我这样写了我的项目/Build.scala:
import sbt._
import Keys._
object MyBuild extends Build {
//Dependencies
val slf4s = "com.weiglewilczek.slf4s" %% "slf4s" % "1.0.6"
val slf4j = "org.slf4j" %% "slf4j-simple" % "1.5.6"
val grizzled = "org.clapper" %% "grizzled-slf4j" % "0.5"
val junit = "junit" % "junit" % "4.8" % "test"
//End dependencies
lazy val root : Project = Project("root", file(".")) aggregate(cli) settings(
mainClass:= Some("Main")
)
lazy val core : Project = Project("core", file("core"), delegates = root :: Nil) settings(
name := "foo-core",
libraryDependencies ++= Seq(grizzled)
)
lazy val cli: Project = Project("cli", file("cli")) dependsOn(core) settings(
name := "foo-cli",
libraryDependencies ++= Seq(grizzled)
)
}
此配置不起作用:当我运行 sbt reload;sbt +update 时,不会下载 grizzled 库(如 http://software.clapper.org/grizzled-slf4j/),因此“导入 grizzli ._" 当我 sbt 编译时,我的核心和 cli 项目失败。
由于我是 scala/sbt 的新手,我想我正在做一些可怕的事情,但无法弄清楚为什么,因为我对建议的所有 sbt 0.7/sbt0.10 冲突配置感到困惑 (例如SBT 中的子项目依赖项)。
有什么想法吗?提示可以帮助我吗?
提前致谢
I have a project foo with two children foo-core and foo-cli, foo-cli depends on foo-core
(I come from Java/Maven and tried to transpose the parent module with 2 submodules architecture).
Following https://github.com/harrah/xsbt/wiki/Full-Configuration, I wrote my project/Build.scala this way:
import sbt._
import Keys._
object MyBuild extends Build {
//Dependencies
val slf4s = "com.weiglewilczek.slf4s" %% "slf4s" % "1.0.6"
val slf4j = "org.slf4j" %% "slf4j-simple" % "1.5.6"
val grizzled = "org.clapper" %% "grizzled-slf4j" % "0.5"
val junit = "junit" % "junit" % "4.8" % "test"
//End dependencies
lazy val root : Project = Project("root", file(".")) aggregate(cli) settings(
mainClass:= Some("Main")
)
lazy val core : Project = Project("core", file("core"), delegates = root :: Nil) settings(
name := "foo-core",
libraryDependencies ++= Seq(grizzled)
)
lazy val cli: Project = Project("cli", file("cli")) dependsOn(core) settings(
name := "foo-cli",
libraryDependencies ++= Seq(grizzled)
)
}
This configuration does not work: grizzled library is not dowloaded when I run sbt reload;sbt +update (as indicated in http://software.clapper.org/grizzled-slf4j/) and thus the "import grizzli._" fail in my core and cli projects when I sbt compile.
Since I'm new to scala/sbt I imagine I'm doing something awful but can't figure why since I'm confused with all sbt 0.7/sbt0.10 conflicting configurations that were suggested
(like Subproject dependencies in SBT).
Any idea? Hint that could help me?
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
那是 grizzled,而不是您用作依赖项的 grizzli。导入是:
这可以从
project cli
和project core
上的console
运行,只需要上面的配置文件即可。您使用的是 SBT 0.10 吗?
That's grizzled, not grizzli you are using as dependency. The import is:
This works here from
console
onproject cli
andproject core
, with nothing more than the configuration file above.Are you using SBT 0.10?