sbt - Why does custom scaladoc task throw MissingRequirementError: object scala.annotation.Annotation in compiler mirror not found? -
i nail missingrequirementerror when seek invoke scaladoc within sbt task.
using version of sbt 0.13.x, start build.sbt
:
val scaladoc = taskkey[unit]("run scaladoc") scaladoc := { import scala.tools.nsc._ val settings = new doc.settings(error => print(error)) settings.usejavacp.value = true val docfactory = new doc.docfactory(new reporters.consolereporter(settings), settings) val universe = docfactory.makeuniverse(left((sources in compile).value.map(_.absolutepath).tolist)) }
then run sbt scaladoc
, , behold (during makeuniverse
):
[info] set current project test (in build file:...) scala.reflect.internal.missingrequirementerror: object scala.annotation.annotation in compiler mirror not found. @ scala.reflect.internal.missingrequirementerror$.signal(missingrequirementerror.scala:16) @ scala.reflect.internal.missingrequirementerror$.notfound(missingrequirementerror.scala:17) @ scala.reflect.internal.mirrors$rootsbase.getmoduleorclass(mirrors.scala:48)
what wrong here? i've tried fork := true
, different combinations of sbt/scala versions no avail.
it seems need provide scala-library
(and indeed, other dependencies) straight docfactory
.
scaladoc := { import scala.tools.nsc._ val settings = new doc.settings(error => print(error)) val dependencypaths = (update in compile).value .select().map(_.absolutepath).mkstring(java.io.file.pathseparator) settings.classpath.append(dependencypaths) settings.bootclasspath.append(dependencypaths) val docfactory = new doc.docfactory(new reporters.consolereporter(settings), settings) val universe = docfactory.makeuniverse(left((sources in compile).value.map(_.absolutepath).tolist)) }
scala sbt scaladoc
No comments:
Post a Comment