idea 运行scala报错 Error compiling sbt component 'compiler-interface-2.13.1-52.0'

idea 运行scala报错 Error compiling sbt component ‘compiler-interface-2.13.1-52.0’

  刚开始学习scala,在idea里创建普通的maven项目后,并且加了scala的插件等,运行项目后报错,如下:

Error:scalac: Error: org.jetbrains.jps.incremental.scala.remote.ServerException
Error compiling sbt component 'compiler-interface-2.13.1-52.0'

	at sbt.compiler.AnalyzingCompiler$$anonfun$compileSources$1$$anonfun$apply$2.apply(AnalyzingCompiler.scala:145)

	at sbt.compiler.AnalyzingCompiler$$anonfun$compileSources$1$$anonfun$apply$2.apply(AnalyzingCompiler.scala:142)

	at sbt.IO$.withTemporaryDirectory(IO.scala:291)

	at sbt.compiler.AnalyzingCompiler$$anonfun$compileSources$1.apply(AnalyzingCompiler.scala:142)

	at sbt.compiler.AnalyzingCompiler$$anonfun$compileSources$1.apply(AnalyzingCompiler.scala:139)

	at sbt.IO$.withTemporaryDirectory(IO.scala:291)

	at sbt.compiler.AnalyzingCompiler$.compileSources(AnalyzingCompiler.scala:139)

	at sbt.compiler.IC$.compileInterfaceJar(IncrementalCompiler.scala:52)

	at org.jetbrains.jps.incremental.scala.local.CompilerFactoryImpl$.getOrCompileInterfaceJar(CompilerFactoryImpl.scala:96)

	at org.jetbrains.jps.incremental.scala.local.CompilerFactoryImpl$$anonfun$getScalac$1.apply(CompilerFactoryImpl.scala:50)

	at org.jetbrains.jps.incremental.scala.local.CompilerFactoryImpl$$anonfun$getScalac$1.apply(CompilerFactoryImpl.scala:49)

	at scala.Option.map(Option.scala:146)

	at org.jetbrains.jps.incremental.scala.local.CompilerFactoryImpl.getScalac(CompilerFactoryImpl.scala:49)

	at org.jetbrains.jps.incremental.scala.local.CompilerFactoryImpl.createCompiler(CompilerFactoryImpl.scala:22)

	at org.jetbrains.jps.incremental.scala.local.CachingFactory$$anonfun$createCompiler$1.apply(CachingFactory.scala:24)

	at org.jetbrains.jps.incremental.scala.local.CachingFactory$$anonfun$createCompiler$1.apply(CachingFactory.scala:24)

	at org.jetbrains.jps.incremental.scala.local.Cache$$anonfun$getOrUpdate$2.apply(Cache.scala:20)

	at scala.Option.getOrElse(Option.scala:121)

	at org.jetbrains.jps.incremental.scala.local.Cache.getOrUpdate(Cache.scala:19)

	at org.jetbrains.jps.incremental.scala.local.CachingFactory.createCompiler(CachingFactory.scala:23)

	at org.jetbrains.jps.incremental.scala.local.LocalServer.compile(LocalServer.scala:22)

	at org.jetbrains.jps.incremental.scala.remote.Main$.make(Main.scala:68)

	at org.jetbrains.jps.incremental.scala.remote.Main$.nailMain(Main.scala:25)

	at org.jetbrains.jps.incremental.scala.remote.Main.nailMain(Main.scala)

	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

	at java.lang.reflect.Method.invoke(Method.java:483)

	at com.martiansoftware.nailgun.NGSession.run(NGSession.java:319)

  分析了好久,才了解到是因为我安装的scala版本2.13.1太高了,换成了2.11.8版本才行的。当然重新换成2.11.8版本后,必须在idea里修改下边才行:
idea 运行scala报错 Error compiling sbt component 'compiler-interface-2.13.1-52.0'_第1张图片
运行后,终于成功了:
idea 运行scala报错 Error compiling sbt component 'compiler-interface-2.13.1-52.0'_第2张图片

你可能感兴趣的:(scala)