Scaladoc,SBT和案例类以及scala版本2.11.x

时间:2015-10-23 13:56:00

标签: scala sbt scaladoc

在带有案例类的Intellij IDEA SBT项目中为scala 2.11.7生成scaladoc时遇到问题。例如,使用以下代码:

package main

/**
  *
 * @param a
  */
case class SomeClass(a: Int) {

}

当我尝试生成scaladoc时,会抛出异常: 错误:

     while compiling: /Users/vicaba/Projects/scaladoc/src/main/scala/main/SomeClass.scala
        during phase: typer
     library version: version 2.10.4
    compiler version: version 2.10.4
  reconstructed args: -Yno-self-type-checks -classpath /Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/lib/jconsole.jar/:/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/jre/lib/jce.jar/:/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/jre/lib/ext/jfxrt.jar/:/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/jre/lib/ext/zipfs.jar/:/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/lib/dt.jar/:/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/jre/lib/jsse.jar/:/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/jre/lib/jfxswt.jar/:/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/jre/lib/resources.jar/:/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/jre/lib/deploy.jar/:/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/jre/lib/jfr.jar/:/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/jre/lib/ext/localedata.jar/:/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/jre/lib/ext/sunec.jar/:/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/jre/lib/ext/nashorn.jar/:/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/jre/lib/charsets.jar/:/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/jre/lib/management-agent.jar/:/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/jre/lib/javaws.jar/:/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/lib/ant-javafx.jar/:/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/lib/javafx-mx.jar/:/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/jre/lib/ext/dnsns.jar/:/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/jre/lib/ext/sunjce_provider.jar/:/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/jre/lib/ext/sunpkcs11.jar/:/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/lib/tools.jar/:/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/lib/packager.jar/:/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/jre/lib/plugin.jar/:/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/jre/lib/rt.jar/:/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/jre/lib/ext/cldrdata.jar/:/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/lib/sa-jdi.jar/:/Users/vicaba/.ivy2/cache/org.scala-lang/scala-library/jars/scala-library-2.11.7.jar/ -sourcepath /Users/vicaba/Projects/scaladoc/target/scala-2.11/src_managed/main:/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/src.zip/:/Users/vicaba/Projects/scaladoc/src/main/java:/Users/vicaba/Projects/scaladoc/target/scala-2.11/src_managed/test:/Users/vicaba/Projects/scaladoc/src/test/scala:/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/javafx-src.zip/:/Users/vicaba/Projects/scaladoc/target/scala-2.11/resource_managed/main:/Users/vicaba/Projects/scaladoc/src/test/resources:/Users/vicaba/Projects/scaladoc/target/scala-2.11/resource_managed/test:/Users/vicaba/Projects/scaladoc/src/main/scala-2.11:/Users/vicaba/Projects/scaladoc/src/test/java:/Users/vicaba/Projects/scaladoc/src/main/scala:/Users/vicaba/Projects/scaladoc/src/test/scala-2.11:/Users/vicaba/Projects/scaladoc/src/main/resources -doc-title scaladoc documentation -d /Users/vicaba/Projects/scaladoc/doc

  last tree to typer: Literal(Constant(()))
              symbol: null
   symbol definition: null
                 tpe: Unit
       symbol owners: 
      context owners: object SomeClass -> package main

== Enclosing template or block ==

ModuleDef( // object SomeClass in package main
  <module> <synthetic>
  "SomeClass"
  Template(
    runtime.this.AbstractFunction1[Int, SomeClass] // parents
    ValDef(
      private
      "_"
      <tpt>
      <empty>
    )
    // 2 statements
    DefDef( // def <init>: <?> in object SomeClass
      <method>
      "<init>"
      []
      List(Nil)
      <tpt>
      Block(
        Apply(
          super."<init>"
          Nil
        )
        ()
      )
    )
    DefDef( // final override def toString: <?> in object SomeClass
      <method> final override <synthetic>
      "toString"
      []
      List(Nil)
      <tpt>
      "SomeClass"
    )
  )
)

== Expanded type of tree ==

TypeRef(TypeSymbol(final abstract class Unit extends AnyVal))

uncaught exception during compilation: scala.reflect.internal.MissingRequirementError
error: fatal error: class scala.annotation.serializable in compiler mirror not found.
two errors found

在此示例中,scaladoc已成功生成,但在我拥有的另一个大项目中,也会抛出此错误,并且不会生成任何内容。这可能是使用2.10.4和我的项目使用2.11.7的问题吗?

0 个答案:

没有答案