Scaladoc (2.11.6) 在带有 "unable to find any member to link" 的 throws 标签上失败

Scaladoc (2.11.6) fails on throws tag with "unable to find any member to link"

尝试通过 sbt "++2.11.6 publishLocal"sbt +publishLocal 为我的项目发布 jar 时,我在为 Scala 2.11.6 发布时遇到了 Scaladoc 问题。看来我有由 @throws 标签引起的无效链接。我不确定为什么我有无效链接,也不知道为什么在我的交叉发布期间错误只发生在 Scala 2.11.6 而不是 Scala 2.10.5。我找不到任何迹象表明 Scala 2.11 不支持 @throws 标签;所以,我假设这是我的 Scaladoc 的问题,但我不知道此时我遗漏了什么。谁能给我一些关于这个问题的见解?

  /**
   * Attempts to load the JDI, asserting that it can be and is loaded.
   *
   * @throws AssertionError If failed to load the JDI
   */
  @throws(classOf[AssertionError])
  protected def assertJdiLoaded(): Unit =
    assert(jdiLoader.tryLoadJdi(),
      """
        |Unable to load Java Debugger Interface! This is part of tools.jar
        |provided by OpenJDK/Oracle JDK and is the core of the debugger! Please
        |make sure that JAVA_HOME has been set and that tools.jar is available
        |on the classpath!
      """.stripMargin.replace("\n", " "))

上面的代码片段(报告的问题之一)是我的项目文件的一部分:https://github.com/rcsenkbeil/scala-debugger/blob/master/scala-debugger-api/src/main/scala/org/senkbeil/debugger/Debugger.scala#L22

实际Scaladoc编译错误系列如下:

[info] Loading project definition from /home/senkwich/projects/scala-debugger/project
[info] Set current project to scala-debugger (in build file:/home/senkwich/projects/scala-debugger/)
[info] Setting version to 2.11.6
[info] Reapplying settings...
[info] Set current project to scala-debugger (in build file:/home/senkwich/projects/scala-debugger/)
[info] Wrote /home/senkwich/projects/scala-debugger/scala-debugger-api/target/scala-2.11/scala-debugger-api_2.11-1.0.0.pom
[info] :: delivering :: org.senkbeil#scala-debugger-api_2.11;1.0.0 :: 1.0.0 :: release :: Sat Jul 18 00:59:01 CDT 2015
[info]  delivering ivy file to /home/senkwich/projects/scala-debugger/scala-debugger-api/target/scala-2.11/ivy-1.0.0.xml
[info] Main Scala API documentation to /home/senkwich/projects/scala-debugger/scala-debugger-api/target/scala-2.11/api...
model contains 35 documentable templates
[error] /home/senkwich/projects/scala-debugger/scala-debugger-api/src/main/scala/org/senkbeil/debugger/wrappers/VirtualMachineWrapper.scala:170: Could not find any member to link for "AssertionError".
[error]   /**
[error]   ^
[error] /home/senkwich/projects/scala-debugger/scala-debugger-api/src/main/scala/org/senkbeil/debugger/wrappers/VirtualMachineWrapper.scala:192: Could not find any member to link for "AssertionError".
[error]   /**
[error]   ^
[error] /home/senkwich/projects/scala-debugger/scala-debugger-api/src/main/scala/org/senkbeil/debugger/wrappers/VirtualMachineWrapper.scala:158: Could not find any member to link for "AssertionError".
[error]   /**
[error]   ^
[error] /home/senkwich/projects/scala-debugger/scala-debugger-api/src/main/scala/org/senkbeil/debugger/wrappers/VirtualMachineWrapper.scala:138: Could not find any member to link for "AssertionError".
[error]   /**
[error]   ^
[error] /home/senkwich/projects/scala-debugger/scala-debugger-api/src/main/scala/org/senkbeil/debugger/wrappers/VirtualMachineWrapper.scala:126: Could not find any member to link for "AssertionError".
[error]   /**
[error]   ^
[error] /home/senkwich/projects/scala-debugger/scala-debugger-api/src/main/scala/org/senkbeil/debugger/wrappers/VirtualMachineWrapper.scala:106: Could not find any member to link for "AssertionError".
[error]   /**
[error]   ^
[error] /home/senkwich/projects/scala-debugger/scala-debugger-api/src/main/scala/org/senkbeil/debugger/wrappers/VirtualMachineWrapper.scala:94: Could not find any member to link for "AssertionError".
[error]   /**
[error]   ^
[error] /home/senkwich/projects/scala-debugger/scala-debugger-api/src/main/scala/org/senkbeil/debugger/wrappers/VirtualMachineWrapper.scala:73: Could not find any member to link for "AssertionError".
[error]   /**
[error]   ^
[error] /home/senkwich/projects/scala-debugger/scala-debugger-api/src/main/scala/org/senkbeil/debugger/wrappers/ValueWrapper.scala:112: Could not find any member to link for "IllegalArgumentException".
[error]   /**
[error]   ^
[error] /home/senkwich/projects/scala-debugger/scala-debugger-api/src/main/scala/org/senkbeil/debugger/wrappers/ValueWrapper.scala:87: Could not find any member to link for "IllegalArgumentException".
[error]   /**
[error]   ^
[error] /home/senkwich/projects/scala-debugger/scala-debugger-api/src/main/scala/org/senkbeil/debugger/wrappers/ValueWrapper.scala:54: Could not find any member to link for "IllegalArgumentException".
[error]   /**
[error]   ^
[error] /home/senkwich/projects/scala-debugger/scala-debugger-api/src/main/scala/org/senkbeil/debugger/wrappers/ValueWrapper.scala:33: Could not find any member to link for "Throwable".
[error]   /**
[error]   ^
[error] /home/senkwich/projects/scala-debugger/scala-debugger-api/src/main/scala/org/senkbeil/debugger/jdi/JDILoader.scala:206: Could not find any member to link for "ClassNotFoundException".
[error]   /**
[error]   ^
[error] /home/senkwich/projects/scala-debugger/scala-debugger-api/src/main/scala/org/senkbeil/debugger/breakpoints/BreakpointBundle.scala:138: Could not find any member to link for "AssertionError".
[error]   /**
[error]   ^
[error] /home/senkwich/projects/scala-debugger/scala-debugger-api/src/main/scala/org/senkbeil/debugger/breakpoints/BreakpointBundle.scala:156: Could not find any member to link for "AssertionError".
[error]   /**
[error]   ^
[error] /home/senkwich/projects/scala-debugger/scala-debugger-api/src/main/scala/org/senkbeil/debugger/breakpoints/BreakpointBundle.scala:110: Could not find any member to link for "AssertionError".
[error]   /**
[error]   ^
[error] /home/senkwich/projects/scala-debugger/scala-debugger-api/src/main/scala/org/senkbeil/debugger/breakpoints/BreakpointBundle.scala:92: Could not find any member to link for "AssertionError".
[error]   /**
[error]   ^
[error] /home/senkwich/projects/scala-debugger/scala-debugger-api/src/main/scala/org/senkbeil/debugger/breakpoints/BreakpointBundle.scala:72: Could not find any member to link for "AssertionError".
[error]   /**
[error]   ^
[error] /home/senkwich/projects/scala-debugger/scala-debugger-api/src/main/scala/org/senkbeil/debugger/Debugger.scala:19: Could not find any member to link for "AssertionError".
[error]   /**
[error]   ^
[error] 19 errors found
[error] (scalaDebuggerApi/compile:doc) Scaladoc generation failed
[error] Total time: 17 s, completed Jul 18, 2015 12:59:17 AM

根据讨论 here,我决定暂时通过添加 Scaladoc 选项来抑制错误 -no-link-warnings

scalacOptions in (Compile, doc) ++= Seq(
  "-no-link-warnings" // Suppresses problems with Scaladoc @throws links
)

请注意,如果您根本不需要 scaladoc-s,可以将它们设为空:

sources in (Compile,doc) := Seq.empty

并且根本不发布:

publishArtifact in packageDoc := false