尝试通过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
)

关于scala - Scaladoc(2.11.6)在throws标签上失败,显示“无法找到要链接的任何成员”,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/31488335/

10-15 14:27