kafka ZkUtils Compile time error - scala

import kafka.utils.{TestUtils, ZKStringSerializer, ZkUtils}
import org.I0Itec.zkclient.{ZkClient, ZkConnection}
import kafka.utils.ZkUtils._
var zkUtils: ZkUtils = _
//val zkConnection= new ZkConnection(zkConn)
//zkClient = new ZkClient(zkConn,5000,5000,ZKStringSerializer)
//val zkUtils = new ZkUtils(zkClient, zkConnection, false)
val (zkClient, zkConnection) = ZkUtils.createZkClientAndConnection(
zkConn, sessionTimeoutMs, connectionTimeoutMs)
zkUtils = new ZkUtils(zkClient, zkConnection, false)
I am trying to create a ZkUtils object but facing issues. My Gradle build is successful but when I try to run the test file, face the below issues
Error:(27, 16) not found: type ZkUtils
var zkUtils: ZkUtils = _
Error:(44, 44) value createZkClientAndConnection is not a member of object kafka.utils.ZkUtils
val (zkClient, zkConnection) = ZkUtils.createZkClientAndConnection(
Error:(46, 20) not found: type ZkUtils
zkUtils = new ZkUtils(zkClient, zkConnection, false)
I have the following dependencies in my gradle build file as well.
compile group: 'org.apache.kafka', name: 'kafka_2.11', version: '0.10.2.1', classifier:'test'
compile group: 'org.apache.kafka', name: 'kafka_2.11', version: '0.10.2.1'
testCompile group: 'org.apache.kafka', name: 'kafka_2.11', version: '0.10.2.1', classifier:'test'
testCompile group: 'org.apache.kafka', name: 'kafka_2.11', version: '0.10.2.1'
I have these imports as well in my file. Can anyone tell me whats going wrong here. Thanks for your help.

Related

java.lang.ClassNotFoundException: com.datastax.spark.connector.rdd.partitioner.CassandraPartition

I've been working with Cassandra for a little while and now I'm trying to setup spark and spark-cassandra-connector. I'm using IntelliJ IDEA to do that (first time with IntelliJ IDEA and Scala too) in Windows 10.
build.gradle
apply plugin: 'scala'
apply plugin: 'idea'
apply plugin: 'eclipse'
repositories {
mavenCentral()
flatDir {
dirs 'runtime libs'
}
}
idea {
project {
jdkName = '1.8'
languageLevel = '1.8'
}
}
dependencies {
compile group: 'org.apache.spark', name: 'spark-core_2.11', version: '2.4.5'
compile group: 'org.apache.spark', name: 'spark-sql_2.11', version: '2.4.5'
compile group: 'org.scala-lang', name: 'scala-library', version: '2.11.12'
compile group: 'com.datastax.spark', name: 'spark-cassandra-connector_2.11', version: '2.5.0'
compile group: 'log4j', name: 'log4j', version: '1.2.17'
}
configurations.all {
resolutionStrategy {
force 'com.google.guava:guava:12.0.1'
}
}
compileScala.targetCompatibility = "1.8"
compileScala.sourceCompatibility = "1.8"
jar {
zip64 true
archiveName = "ModuleName.jar"
from {
configurations.compile.collect {
it.isDirectory() ? it : zipTree(it)
}
}
manifest {
attributes 'Main-Class': 'org.module.ModuelName'
}
exclude 'META-INF/*.RSA', 'META-INF/*.SF', 'META-INF/*.DSA'
}
ModuleName.scala
package org.module
import org.apache.spark.sql.SparkSession
import com.datastax.spark.connector._
import org.apache.spark.sql.types.TimestampType
object SentinelSparkModule {
case class Document(id: Int, time: TimestampType, data: String)
def main(args: Array[String]) {
val spark = SparkSession.builder
.master("spark://192.168.0.3:7077")
.appName("App")
.config("spark.cassandra.connection.host", "127.0.0.1")
.config("spark.cassandra.connection.port", "9042")
.getOrCreate()
//I'm trying it without [Document] since it throws 'Failed to map constructor parameter id in
//org.module.ModuleName.Document to a column of keyspace.table'
val documentRDD = spark.sparkContext
.cassandraTable/*[Document]*/("keyspace", "table")
.select()
documentRDD.take(10).foreach(println)
spark.stop()
}
}
I have a running spark master at spark://192.168.0.3:7077 and a worker of that master, but I haven't tried to submit the job as a compiled jar in the console, I'm just trying to get it to work in the IDE.
Thanks
Cassandra connector jar needs to be added to the classpath of workers. One way to do this is to build an uber jar with all required dependencies and submit to the cluster.
Refer to: Building a uberjar with Gradle
Also, make sure you change the scope of dependencies in you build file from compile to provided for all jars except the cassandra connector.
Reference: https://reflectoring.io/maven-scopes-gradle-configurations/

How to create a Scala presentation compiler inside Ammonite REPL?

I want to create a Scala presentation compiler in Ammonite REPL, however I always got the error of Missing dependency 'object scala in compiler mirror'.
I have tried the workaround mentioned in object scala in compiler mirror not found - running Scala compiler programatically . Unfortunately it does not work.
How to make it work?
Welcome to the Ammonite Repl 1.0.0
(Scala 2.12.2 Java 1.8.0_131)
If you like Ammonite, please support our development at www.patreon.com/lihaoyi
# import scala.tools.nsc.Settings
import scala.tools.nsc.Settings
# import scala.tools.nsc.interactive.Global
import scala.tools.nsc.interactive.Global
# import scala.tools.nsc.reporters.ConsoleReporter
import scala.tools.nsc.reporters.ConsoleReporter
# val settings = new Settings()
settings: Settings = Settings {
-d = .
}
# settings.usejavacp.value = true
# val reporter = new ConsoleReporter(settings)
reporter: ConsoleReporter = scala.tools.nsc.reporters.ConsoleReporter#4a24170b
# val compiler = new Global(settings, reporter)
error: error while loading Object, Missing dependency 'object scala in compiler mirror', required by /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/rt.jar(java/lang/Object.class)
scala.reflect.internal.MissingRequirementError: object scala in compiler mirror not found.
scala.reflect.internal.MissingRequirementError$.signal(MissingRequirementError.scala:17)
scala.reflect.internal.MissingRequirementError$.notFound(MissingRequirementError.scala:18)
scala.reflect.internal.Mirrors$RootsBase.$anonfun$getModuleOrClass$4(Mirrors.scala:54)
scala.reflect.internal.Mirrors$RootsBase.getModuleOrClass(Mirrors.scala:54)
scala.reflect.internal.Mirrors$RootsBase.getModuleOrClass(Mirrors.scala:66)
scala.reflect.internal.Mirrors$RootsBase.getPackage(Mirrors.scala:172)
scala.reflect.internal.Definitions$DefinitionsClass.ScalaPackage$lzycompute(Definitions.scala:169)
scala.reflect.internal.Definitions$DefinitionsClass.ScalaPackage(Definitions.scala:169)
scala.reflect.internal.Definitions$DefinitionsClass.ScalaPackageClass$lzycompute(Definitions.scala:170)
scala.reflect.internal.Definitions$DefinitionsClass.ScalaPackageClass(Definitions.scala:170)
scala.reflect.internal.Definitions$DefinitionsClass.init(Definitions.scala:1447)
scala.tools.nsc.Global$Run.<init>(Global.scala:1149)
scala.tools.nsc.interactive.Global$TyperRun.<init>(Global.scala:1308)
scala.tools.nsc.interactive.Global.newTyperRun(Global.scala:1331)
scala.tools.nsc.interactive.Global.<init>(Global.scala:286)
ammonite.$sess.cmd6$.<init>(cmd6.sc:1)
ammonite.$sess.cmd6$.<clinit>(cmd6.sc)
The same code works in official Scala REPL.
Welcome to Scala 2.12.2 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_131).
Type in expressions for evaluation. Or try :help.
scala> import scala.tools.nsc.Settings
import scala.tools.nsc.Settings
scala> import scala.tools.nsc.interactive.Global
import scala.tools.nsc.interactive.Global
scala> import scala.tools.nsc.reporters.ConsoleReporter
import scala.tools.nsc.reporters.ConsoleReporter
scala> val settings = new Settings()
settings: scala.tools.nsc.Settings =
Settings {
-d = .
}
scala> settings.usejavacp.value = true
settings.usejavacp.value: Boolean = true
scala> val reporter = new ConsoleReporter(settings)
reporter: scala.tools.nsc.reporters.ConsoleReporter = scala.tools.nsc.reporters.ConsoleReporter#7eeb38b2
scala> val compiler = new Global(settings, reporter)
compiler: scala.tools.nsc.interactive.Global = scala.tools.nsc.interactive.Global#3b6a4b91

scala.reflect.internal.MissingRequirementError: object java.lang.Object in compiler mirror not found

I'am trying to build spark streaming application using sbt package,I can't discover what's the reason of this error.
this is some thing of the error
scala.reflect.internal.MissingRequirementError: object
java.lang.Object in compiler mirror not found. at
scala.reflect.internal.MissingRequirementError$.signal(MissingRequirementError.scala:16)
at
scala.reflect.internal.MissingRequirementError$.notFound(MissingRequirementError.scala:17)
at
scala.reflect.internal.Mirrors$RootsBase.getModuleOrClass(Mirrors.scala:48)
at
scala.reflect.internal.Mirrors$RootsBase.getModuleOrClass(Mirrors.scala:40)
at
scala.reflect.internal.Mirrors$RootsBase.getModuleOrClass(Mirrors.scala:40)
and here is the code
import org.apache.spark.SparkContext
import org.apache.spark._
import org.apache.spark.streaming._
import org.apache.spark.streaming.twitter._
import twitter4j.Status
object TrendingHashTags {
def main(args: Array[String]): Unit = {
val Array(consumerKey, consumerSecret, accessToken, accessTokenSecret,
lang, batchInterval, minThreshold, showCount ) = args.take(8)
val filters = args.takeRight(args.length - 8)
System.setProperty("twitter4j.oauth.consumerKey", consumerKey)
System.setProperty("twitter4j.oauth.consumerSecret", consumerSecret)
System.setProperty("twitter4j.oauth.accessToken", accessToken)
System.setProperty("twitter4j.oauth.accessTokenSecret", accessTokenSecret)
val conf = new SparkConf().setAppName("TrendingHashTags")
val ssc = new StreamingContext(conf, Seconds(batchInterval.toInt))
val tweets = TwitterUtils.createStream(ssc, None, filters)
val tweetsFilteredByLang = tweets.filter{tweet => tweet.getLang() == lang}
val statuses = tweetsFilteredByLang.map{ tweet => tweet.getText()}
val words = statuses.flatMap{status => status.split("""\s+""")}
val hashTags = words.filter{word => word.startsWith("#")}
val hashTagPairs = hashTags.map{hashtag => (hashtag, 1)}
val tagsWithCounts = hashTagPairs.updateStateByKey(
(counts: Seq[Int], prevCount: Option[Int]) =>
prevCount.map{c => c + counts.sum}.orElse{Some(counts.sum)}
)
val topHashTags = tagsWithCounts.filter{ case(t, c) =>
c > minThreshold.toInt
}
val sortedTopHashTags = topHashTags.transform{ rdd =>
rdd.sortBy({case(w, c) => c}, false)
}
sortedTopHashTags.print(showCount.toInt)
ssc.start()
ssc.awaitTermination()
}
}
I solved this issue ,I found that I used java 9 that isn't compatible with scala version so I migrated from java 9 into java 8.
The error means that scala was compiled using a version of java, different from the current version.
I am using maven instead of sbt, but the same behavior is observed.
Find the java version:
> /usr/libexec/java_home -V
Matching Java Virtual Machines (2):
15.0.1, x86_64: "OpenJDK 15.0.1" /Users/noname/Library/Java/JavaVirtualMachines/openjdk-15.0.1/Contents/Home
1.8.0_271, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_271.jdk/Contents/Home
If you installed scala, while you were on version >1.8 and then downgraded the java version (edited the $JAVA_HOME to point to 1.8), you will get this error.
Checked the scala version being used by the project :
$ ls -l /Users/noname/.m2/repository/org/scala-lang/scala-library/2.11.11/scala-library-2.11.11.jar
-rwxrwxrwx 1 noname staff 0 Nov 17 03:41 /Users/noname/.m2/repository/org/scala-lang/scala-library/2.11.11/scala-library-2.11.11.jar
To rectify the issue, remove the scala jar file:
$ rm /Users/noname/.m2/repository/org/scala-lang/scala-library/2.11.11/scala-library-2.11.11.jar
Now, execute mvn clean install again and the project would compile.
I had faced this issue when I had to downgrade my projects Scala version to use a dependency that was compiled in a lower Scala version and could not resolved it even after I made sure JDK and all other dependencies are compatible with the downgraded Scala library version.
As #ForeverLearner mentioned above, deleting Scala library versions higher than the one I am now using to compile project from maven repo (/Users/<>/.m2/repository/org/scala-lang/scala-library/...) helped me get rid of this error
The above fix resolved my issue as well (setting Java 8) , If you are using Intellij you can go to Project Settings and under Project change the Project SDK to 1.8 .

Convert ANT based NetBeans project to Gradle project?

I have a NetBeans web project building Java, JS and HTML files. In order to get retrofit working to import a JSON API, I need to inject a dependency in a build.gradle file in the root of the project. I've written a headless build.gradle file, which I've tested and correctly handles the dependencies, how do I now change project to run from the build.gradle file instead of ANT everytime and searching through libraries?
You need a build.gradle and settings.gradle file, and you have to delete the build.xml file (and maybe the nbproject/ directory)
I recommend making a gradle project using the netbeans gradle plugin and copying over and modifying the build.gradle file.
Then you need to add source sets in your build.gradle for where your sources are - gradle expects them in different place than netbeans ant puts them
sourceSets {
main {
java {
srcDir 'src'
}
resources {
srcDir 'resources'
}
}
test {
java {
srcDir 'test'
}
resources {
srcDir 'testResources'
}
}
}
also, you need to make your dependencies. This is what mine looks like:
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.10+'
compile project(':logger')
compile project(':postalker')
compile group: 'org.yaml', name: 'snakeyaml', version: '1.15+'
compile group: 'commons-io', name: 'commons-io', version: '2.4+'
compile group: 'gov.nist.math', name: 'jama', version: '1.0.3+'
compile group: 'org.apache.commons', name: 'commons-imaging', version: '1.0-SNAPSHOT+'
compile group: 'com.itextpdf', name: 'itextpdf', version: '5.5.5+'
compile files( 'lib/jogl-runtime/jogl.jar')
compile files( 'lib/gluegen-runtime/gluegen-rt.jar')
compile files( 'lib/toxiclibscore.jar')
compile group: 'org.apache.commons', name: 'commons-math3', version: '3.5+'
compile group: 'commons-codec', name: 'commons-codec', version: '1.6'
compile group: 'commons-logging', name: 'commons-logging', version: '1.1.3'
compile group: 'org.apache.httpcomponents', name: 'httpcore', version: '4.3.3'
compile group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.3.6'
compile group: 'org.apache.httpcomponents', name: 'httpmime', version: '4.3.6'
}
finally,
I had to close the old project, shut netbeans down, then re-open netbeans and the project. Do a reload project and it was up and running!
for the person wondering how I got jogl working, I looked at what the jogl plugin did with ant and replicated it with gradle. I add a PlatformPrivate.gradle file that contains the developer's platform, then copy the appropriate libraries to the build directory
my entire build.gradle:
import com.protocase.files.FolderUtils
import java.nio.file.Files
import java.nio.file.Paths
import com.protocase.designer.extractors.BuildInfoExtractor
import com.protocase.designer.fileeditors.NSISInstallerModifier
import com.protocase.designer.fileeditors.SignBatModifier
import com.protocase.designer.ConfigureRun
import com.protocase.finders.FindFiles
apply plugin: 'java'
apply plugin: 'application'
apply plugin: 'groovy'
apply from: "PlatformPrivate.gradle"
apply from: "Platforms.gradle"
sourceCompatibility = '1.6'
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
// NetBeans will automatically add "run" and "debug" tasks relying on the
// "mainClass" property. You may however define the property prior executing
// tasks by passing a "-PmainClass=<QUALIFIED_CLASS_NAME>" argument.
//
// Note however, that you may define your own "run" and "debug" task if you
// prefer. In this case NetBeans will not add these tasks but you may rely on
// your own implementation.
if (!hasProperty('mainClass')) {
ext.mainClass = 'com.protocase.viewer.JDesigner'
}
if (! hasProperty('localPlatform')) {
throw new GradleException("Missing PlatformPrivate.gradle");
}
mainClassName = ext.mainClass
repositories {
mavenCentral()
maven {
url "https://repository.apache.org/content/repositories/snapshots/"
}
}
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.10+'
compile project(':logger')
compile project(':postalker')
compile group: 'org.yaml', name: 'snakeyaml', version: '1.15+'
compile group: 'commons-io', name: 'commons-io', version: '2.4+'
compile group: 'gov.nist.math', name: 'jama', version: '1.0.3+'
compile group: 'org.apache.commons', name: 'commons-imaging', version: '1.0-SNAPSHOT+'
compile group: 'com.itextpdf', name: 'itextpdf', version: '5.5.5+'
compile files( 'lib/jogl-runtime/jogl.jar')
compile files( 'lib/gluegen-runtime/gluegen-rt.jar')
compile files( 'lib/toxiclibscore.jar')
compile group: 'org.apache.commons', name: 'commons-math3', version: '3.5+'
compile group: 'commons-codec', name: 'commons-codec', version: '1.6'
compile group: 'commons-logging', name: 'commons-logging', version: '1.1.3'
compile group: 'org.apache.httpcomponents', name: 'httpcore', version: '4.3.3'
compile group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.3.6'
compile group: 'org.apache.httpcomponents', name: 'httpmime', version: '4.3.6'
}
task copyDistLibs(type: Copy) {
def outputDir = file("${buildDir}/libs")
from configurations.runtime
into outputDir
}
task updateBuildInfoBeta (type: Exec) {
workingDir "${projectDir}/perl"
commandLine './updateBuildInfo'
def extractor = new BuildInfoExtractor(projectFile: new File("${projectDir}"))
def version = extractor.getBetaVersion()
def installerModifier = new NSISInstallerModifier(NSISFile: new File("${projectDir}/winRunFiles/JDesigner.nsi"))
installerModifier.setOutputFileVersion(version)
def signBatModifier = new SignBatModifier(signBatFile: new File("${projectDir}/sign.bat"))
signBatModifier.setOutputFileVersion(version)
println ""
println "Making Beta Version: " + version
println "branch: " + extractor.getReleaseVersion() + " date: " + extractor.getBuildDate()
println ""
}
task makeBeta(dependsOn: updateBuildInfoBeta) {
def distFolderLinux64 = makeOneDistBeta("linux-amd64")
def ditsFolderLinux32 = makeOneDistBeta("linux-i586")
def distFolderWin32 = makeOneDistBeta("windows-i586")
FolderUtils.copyFolderContents(new File("${projectDir}/jre"), new File(distFolderWin32, "jre"))
FolderUtils.copyFolderContents(new File("${projectDir}/src/main/resources/library"), new File(distFolderWin32, "library"))
FolderUtils.copyFolderContents(new File("${projectDir}/winRunFiles"), distFolderWin32)
Files.copy(Paths.get("${projectDir}/license.txt"), Paths.get(new File(distFolderWin32, "license.txt").path))
Files.copy(Paths.get("${projectDir}/Protocase Designer.ico"), Paths.get(new File(distFolderWin32, "Protocase Designer.ico").path))
def distFolderMac = makeOneDistBeta("macosx-universal")
}
private File makeOneDistBeta(def nativePlatform) {
def plat = new com.protocase.designer.Platform(natives: nativePlatform, libFolder: 'lib', genericBuildDir: new File("${buildDir}"))
println plat.getNativeDistDir()
plat.makeAndPopulateBuildDir()
plat.copyLibraryFiles()
plat.getNativeDistDir()
}
makeBeta.dependsOn(jar)
makeBeta.dependsOn(copyDistLibs)
task makeWin32Beta(dependsOn: makeBeta, type: Exec) {
def wineDir = new File("${projectDir}/../../.wine/drive_c/")
println wineDir.exists()
def nsisFile = FindFiles.findFirstFileByNameWithoutDirectory(wineDir, "makensis.exe", "users")
println nsisFile.path
def MAKENSIS = nsisFile.getPath().replaceFirst("(.*)drive_c/", "c:\\\\")
println MAKENSIS
MAKENSIS = MAKENSIS.replaceAll("/","\\\\")
def extractor = new BuildInfoExtractor(projectFile: new File("${projectDir}"))
def version = extractor.getBetaVersion()
workingDir "${buildDir}/windows-i586"
def fullCommand = 'WINEDEBUG=fixme-win,fixme-sync,fixme-heap /usr/bin/wine "' + MAKENSIS + '" /V1 /DVER_STR=' + version + ' /X"SetCompressor /FINAL lzma" ./JDesigner.nsi'
println "makensis command:"
println MAKENSIS
println fullCommand
println ""
commandLine fullCommand
}
private void configureRun (def task) {
apply from: 'PlatformPrivate.gradle'
def confRun = new ConfigureRun(localPlatform: localPlatform)
confRun.configureRun(task, mainClass, sourceSets)
}
run {
configureRun(it)
}
task(debug, dependsOn: 'classes', type: JavaExec) {
configureRun(it)
debug = true
}
The PlatformPrivate.gradle
ext {
localPlatform='linux-amd64'
}
com.protocase.designer.Platform:
package com.protocase.designer
import com.protocase.files.FolderUtils
import org.gradle.api.GradleException
import static groovy.io.FileType.FILES
import java.nio.file.StandardCopyOption
import java.io.File
import java.nio.file.Files
import java.nio.file.Paths
public class Platform {
def natives
def libFolder
def genericBuildDir
String gluegenDir() {
def dirName = 'gluegen-rt.jar-natives-' + natives
dirName
}
String joglDir() {
def dirName = "jogl.jar-natives-" + natives
dirName
}
def getExtension() {
def result = ""
switch (natives)
{
case 'linux-amd64':
case 'linux-i586':
case 'solaris-i586':
case 'solaris-sparc':
case 'solaris-sparcv9':
result = 'so'
break;
case 'macosx-universal':
case 'macosx-ppc':
result = 'jnilib'
break;
case 'windows-i586':
case 'windows-amd64':
result = 'dll'
break;
default:
throw new GradleException ('programmer missed a case or bad platform: ' + natives)
}
result
}
def getNativeDistDir() {
def buildDir = new File(genericBuildDir, natives)
}
def makeAndPopulateBuildDir() {
def sourceDir = new File(genericBuildDir, 'libs')
def nativeDistDir = getNativeDistDir()
if (nativeDistDir.exists()) {
FolderUtils.deleteFolder(nativeDistDir)
}
FolderUtils.copyFolderContents(sourceDir, nativeDistDir)
}
def getLibraryDirs() {
def dirList = []
def dir = new File(new File(libFolder, "gluegen-runtime"), gluegenDir())
dirList << dir
dir = new File(new File(libFolder, "jogl-runtime"), joglDir())
dirList << dir
dirList
}
def getLibraryFiles() {
def fileList = []
def dirs = getLibraryDirs()
dirs.each {
it.eachFile(FILES) {
file -> fileList << file
}
}
fileList
}
def copyLibraryFiles() {
def copyOptions = [StandardCopyOption.REPLACE_EXISTING, StandardCopyOption.COPY_ATTRIBUTES]
def destinationFolder = new File(getNativeDistDir(), 'lib')
getLibraryDirs().each {
FolderUtils.copyFolderContents(it, destinationFolder)
}
}
}

Why does custom scaladoc task throw MissingRequirementError: object scala.annotation.Annotation in compiler mirror not found?

I hit a MissingRequirementError when I try to invoke scaladoc from within an sbt task.
Using any version of sbt 0.13.x, start with this 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, and behold (during makeUniverse):
[info] Set current project to test (in build file:...)
scala.reflect.internal.MissingRequirementError: object scala.annotation.Annotation in compiler mirror not found.
at scala.reflect.internal.MissingRequirementError$.signal(MissingRequirementError.scala:16)
at scala.reflect.internal.MissingRequirementError$.notFound(MissingRequirementError.scala:17)
at scala.reflect.internal.Mirrors$RootsBase.getModuleOrClass(Mirrors.scala:48)
What is wrong here? I've already tried fork := true and different combinations of sbt/scala versions to no avail.
It seems you need to provide scala-library (and indeed, any other dependencies) directly to the 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))
}