我试图通过创建一个新的SBT程序并将sbt-launcher.jar添加到lib目录来嵌入SBT。
package testapp
import xsbt.boot._
object TestMain extends App {
Boot.main(new Array[String](0))
}
但是,无法运行以下错误。
Exception in thread "main" java.lang.IncompatibleClassChangeError: Expected static method scala.Predef$.refArrayOps([Ljava/lang/Object;)Lscala/collection/mutable/ArrayOps;
at xsbt.boot.Boot$.main(Boot.scala:11)
at xsbt.boot.Boot.main(Boot.scala)
at testapp.TestMain$.delayedEndpoint$testapp$TestMain$1(TestMain.scala:15)
at testapp.TestMain$delayedInit$body.apply(TestMain.scala:14)
at scala.Function0$class.apply$mcV$sp(Function0.scala:34)
at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
at scala.App$$anonfun$main$1.apply(App.scala:76)
at scala.App$$anonfun$main$1.apply(App.scala:76)
at scala.collection.immutable.List.foreach(List.scala:381)
at scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:35)
at scala.App$class.main(App.scala:76)
at testapp.TestMain$.main(TestMain.scala:14)
at testapp.TestMain.main(TestMain.scala)