【问题标题】:How to generate links to standard library types in scaladoc?如何在 scaladoc 中生成标准库类型的链接?
【发布时间】:2014-12-21 10:05:39
【问题描述】:

我正在使用 sbt 0.13.7 和 Scala 2.11.4。

在我的build.sbt 中,我有:

autoAPIMappings := true

File.scala:

/** scaladoc link to [[scala.concurrent.duration.FiniteDuration]] */

运行 sbt doc 时,我得到:

[warn] ...:5: Could not find any member to link for "scala.concurrent.duration.FiniteDuration".
[warn] /** scaladoc link to [[scala.concurrent.duration.FiniteDuration]] */
[warn] ^

现在,当我将 autoAPIMappings := true 替换为:

apiMappings += (scalaInstance.value.libraryJar ->
                url(s"http://www.scala-lang.org/api/${scalaVersion.value}/"))

编译器仍然给出警告。

有什么解决办法?

【问题讨论】:

  • 它适用于autoAPIMappings := truesbt 0.13.6scala 2.11.2
  • @lisak 介意将您的评论作为答案吗?对我来说效果很好。
  • 这只是一个提示 :-) 这可能是 SBT 0.13.7 或 scala 2.11.4 或该版本组合中的错误。我认为回答这个问题的人应该识别出这个错误,以便它有资格作为答案:-)
  • @JacekLaskowski,感谢您使帖子更加真实,但是,,以后不要破坏我的语法、标点符号和文字游戏。 :) 谢谢。

标签: scala sbt scaladoc


【解决方案1】:

我无法使用 sbt 0.13.7 和 Scala 2.11.4 重现此行为。

您有多项目设置吗?如果是这样,请确保为每个项目显式添加设置,或在ThisBuild 范围内定义通用设置。

project/build.properties

sbt.version=0.13.7

build.sbt

lazy val commonSettings = Seq(
  scalaVersion := "2.11.4",
  autoAPIMappings := true
)

lazy val root = (project in file(".")).
  aggregate(app).
  settings(commonSettings: _*)

lazy val app = (project in file("app")).
  settings(commonSettings: _*)

src/main/scala/Hello.scala

/** scaladoc link to [[scala.concurrent.duration.FiniteDuration]] */
object Hello extends App {

}

【讨论】:

  • 这是一个单项目设置。清除 ~/.ivy2/~/.sbt/ 修复了这个问题。谢谢你。 :-)
猜你喜欢
  • 2013-05-31
  • 2012-11-06
  • 2014-07-09
  • 1970-01-01
  • 2015-08-11
  • 2016-04-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多