由于需要同时使用Eclipse和sbt,我有一些非标准的sbt构建设置。
我的来源位于src/main/scala
和src/com/companyname/[folder1, folder2, etc]
目录中。
如何设置sbt,以便为folderX
下的其他src/com/companyname
文件夹生成文档?
答案 0 :(得分:1)
tl; dr 在build.sbt
中使用以下内容:
unmanagedSourceDirectories in Compile += sourceDirectory.value
inspect
是你的朋友。
> inspect doc
[info] Task: java.io.File
[info] Description:
[info] Generates API documentation.
[info] Provided by:
[info] {file:/Users/jacek/sandbox/scaladoc/}scaladoc/compile:doc
[info] Defined at:
[info] (sbt.Defaults) Defaults.scala:706
[info] Dependencies:
[info] compile:doc::configuration
[info] compile:doc::sources
[info] compile:doc::apiMappings
[info] compile:doc::target
[info] compile:doc::fileInputOptions
[info] compile:doc::streams
[info] compile:doc::compilers
[info] compile:doc::scalacOptions
[info] compile:doc::dependencyClasspath
[info] compile:doc::maxErrors
[info] compile:doc::javacOptions
[info] Reverse dependencies:
[info] *:copyDocAssetsTask
[info] Delegates:
[info] compile:doc
[info] *:doc
[info] {.}/compile:doc
[info] {.}/*:doc
[info] */compile:doc
[info] */*:doc
[info] Related:
[info] test:doc
在Dependencies
下,您会发现doc
任务取决于compile:doc::sources
等。再次使用inspect
设置。
> inspect compile:doc::sources
[info] Task: scala.collection.Seq[java.io.File]
[info] Description:
[info] All sources, both managed and unmanaged.
[info] Provided by:
[info] {file:/Users/jacek/sandbox/scaladoc/}scaladoc/compile:sources
[info] Defined at:
[info] (sbt.Defaults) Defaults.scala:187
[info] Reverse dependencies:
[info] compile:doc
[info] Delegates:
[info] compile:doc::sources
[info] compile:sources
[info] *:doc::sources
[info] *:sources
[info] {.}/compile:doc::sources
[info] {.}/compile:sources
[info] {.}/*:doc::sources
[info] {.}/*:sources
[info] */compile:doc::sources
[info] */compile:sources
[info] */*:doc::sources
[info] */*:sources
[info] Related:
[info] compile:sources
[info] test:sources
在Dependencies
下,您发现它取决于compile:sources
,并且您发现应该更改unmanagedSourceDirectories
设置以获得您想要的内容。