使用Idea创建Scala项目报错scalac: Error: Error compiling the sbt component ‘compiler-interface-2.10.0-52.0‘

错误日志:

scalac: Error: Error compiling the sbt component 'compiler-interface-2.10.0-52.0'
sbt.internal.inc.CompileFailed: Error compiling the sbt component 'compiler-interface-2.10.0-52.0'
    at sbt.internal.inc.AnalyzingCompiler$.handleCompilationError$1(AnalyzingCompiler.scala:424)
    at sbt.internal.inc.AnalyzingCompiler$.$anonfun$compileSources$5(AnalyzingCompiler.scala:441)
    at sbt.internal.inc.AnalyzingCompiler$.$anonfun$compileSources$5$adapted(AnalyzingCompiler.scala:436)
    at sbt.io.IO$.withTemporaryDirectory(IO.scala:490)
    at sbt.io.IO$.withTemporaryDirectory(IO.scala:500)
    at sbt.internal.inc.AnalyzingCompiler$.$anonfun$compileSources$2(AnalyzingCompiler.scala:436)
    at sbt.internal.inc.AnalyzingCompiler$.$anonfun$compileSources$2$adapted(AnalyzingCompiler.scala:428)
    at sbt.io.IO$.withTemporaryDirectory(IO.scala:490)
    at sbt.io.IO$.withTemporaryDirectory(IO.scala:500)
    at sbt.internal.inc.AnalyzingCompiler$.compileSources(AnalyzingCompiler.scala:428)
    at org.jetbrains.jps.incremental.scala.local.CompilerFactoryImpl$.org$jetbrains$jps$incremental$scala$local$CompilerFactoryImpl$$getOrCompileInterfaceJar(CompilerFactoryImpl.scala:154)
    at org.jetbrains.jps.incremental.scala.local.CompilerFactoryImpl.$anonfun$getScalac$1(CompilerFactoryImpl.scala:54)
    at scala.Option.map(Option.scala:242)
    at org.jetbrains.jps.incremental.scala.local.CompilerFactoryImpl.getScalac(CompilerFactoryImpl.scala:47)
    at org.jetbrains.jps.incremental.scala.local.CompilerFactoryImpl.createCompiler(CompilerFactoryImpl.scala:25)
    at org.jetbrains.jps.incremental.scala.local.CachingFactory.$anonfun$createCompiler$3(CachingFactory.scala:24)
    at org.jetbrains.jps.incremental.scala.local.Cache.$anonfun$getOrUpdate$2(Cache.scala:20)
    at scala.Option.getOrElse(Option.scala:201)
    at org.jetbrains.jps.incremental.scala.local.Cache.getOrUpdate(Cache.scala:19)
    at org.jetbrains.jps.incremental.scala.local.CachingFactory.createCompiler(CachingFactory.scala:24)
    at org.jetbrains.jps.incremental.scala.local.LocalServer.doCompile(LocalServer.scala:43)
    at org.jetbrains.jps.incremental.scala.local.LocalServer.compile(LocalServer.scala:30)
    at org.jetbrains.jps.incremental.scala.remote.Main$.compileLogic(Main.scala:207)
    at org.jetbrains.jps.incremental.scala.remote.Main$.$anonfun$handleCommand$1(Main.scala:190)
    at org.jetbrains.jps.incremental.scala.remote.Main$.decorated$1(Main.scala:180)
    at org.jetbrains.jps.incremental.scala.remote.Main$.handleCommand(Main.scala:187)
    at org.jetbrains.jps.incremental.scala.remote.Main$.serverLogic(Main.scala:163)
    at org.jetbrains.jps.incremental.scala.remote.Main$.nailMain(Main.scala:103)
    at org.jetbrains.jps.incremental.scala.remote.Main.nailMain(Main.scala)
    at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.martiansoftware.nailgun.NGSession.run(NGSession.java:319)

问题原因:pom.xml中配置scala.version与本地安装Scala版本不一致,本地安装为:2.12.15

解决方案:替换版本号

 

 

 

 

你可能感兴趣的:(问题解决,scala,intellij-idea)