我在 Maven 项目的
runtime
范围内有依赖关系:
<dependency>
<groupId>org.docbook</groupId>
<artifactId>docbook-xml</artifactId>
<version>4.4</version>
<scope>runtime</scope>
</dependency>
我如何用 SBT 表达这个?
你应该使用 Runtime 配置
build.sbt
中的依赖如下:
libraryDependencies += "org.docbook" % "docbook-xml" % "4.4" % Runtime
有了这个,应该正确设置类路径 -
show managedClasspath
compile
和 runtime
配置来验证它:
[sbt-13-0-1]> help dependencyClasspath
The classpath consisting of internal and external, managed and unmanaged dependencies.
[sbt-13-0-1]> show managedClasspath
[info] List(Attributed(/Users/jacek/.sbt/boot/scala-2.10.3/lib/scala-library.jar))
[success] Total time: 0 s, completed Jan 1, 2014 12:10:57 AM
[sbt-13-0-1]> show runtime:managedClasspath
[info] List(Attributed(/Users/jacek/.sbt/boot/scala-2.10.3/lib/scala-library.jar), Attributed(/Users/jacek/.ivy2/cache/org.docbook/docbook-xml/jars/docbook-xml-4.4.jar))
[success] Total time: 0 s, completed Jan 1, 2014 12:11:01 AM