你好,游客 登录
背景:
阅读新闻

Scala报错:Error:scalac: Error: org.jetbrains.jps.incremental.scala.remote.ServerException

[日期:2018-09-15] 来源:csdn  作者: [字体: ]

Scala使用IDEA编译时,可能会报下面的错误

Error:scalac: Error: org.jetbrains.jps.incremental.scala.remote.ServerException
Error compiling sbt component 'compiler-interface-2.12.3-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:285)

   at sbt.compiler.AnalyzingCompiler

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

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

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

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

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

   at org.jetbrains.jps.incremental.scala.local.CompilerFactoryImpl$.org$jetbrains$jps$incremental$scala$local$CompilerFactoryImpl

getOrCompileInterfaceJar(CompilerFactoryImpl.scala:87)atorg.jetbrains.jps.incremental.scala.local.CompilerFactoryImpl

anonfun$getScalac$1.apply(CompilerFactoryImpl.scala:44)

   at org.jetbrains.jps.incremental.scala.local.CompilerFactoryImpl

anonfun$getScalac$1.apply(CompilerFactoryImpl.scala:43)atscala.Option.map(Option.scala:145)atorg.jetbrains.jps.incremental.scala.local.CompilerFactoryImpl.getScalac(CompilerFactoryImpl.scala:43)atorg.jetbrains.jps.incremental.scala.local.CompilerFactoryImpl.createCompiler(CompilerFactoryImpl.scala:22)atorg.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)atorg.jetbrains.jps.incremental.scala.local.Cache

anonfun$getOrUpdate$2.apply(Cache.scala:20)

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

   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:62)

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

   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:498)

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



Error:scalac: Error: org.jetbrains.jps.incremental.scala.remote.ServerException
Error compiling sbt component 'compiler-interface-2.12.3-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:285)

   at sbt.compiler.AnalyzingCompiler

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

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

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

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

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

   at org.jetbrains.jps.incremental.scala.local.CompilerFactoryImpl$.org$jetbrains$jps$incremental$scala$local$CompilerFactoryImpl

getOrCompileInterfaceJar(CompilerFactoryImpl.scala:87)atorg.jetbrains.jps.incremental.scala.local.CompilerFactoryImpl

anonfun$getScalac$1.apply(CompilerFactoryImpl.scala:44)

   at org.jetbrains.jps.incremental.scala.local.CompilerFactoryImpl

anonfun$getScalac$1.apply(CompilerFactoryImpl.scala:43)atscala.Option.map(Option.scala:145)atorg.jetbrains.jps.incremental.scala.local.CompilerFactoryImpl.getScalac(CompilerFactoryImpl.scala:43)atorg.jetbrains.jps.incremental.scala.local.CompilerFactoryImpl.createCompiler(CompilerFactoryImpl.scala:22)atorg.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)atorg.jetbrains.jps.incremental.scala.local.Cache

anonfun$getOrUpdate$2.apply(Cache.scala:20)

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

   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:62)

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

   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:498)

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



出现这种问题一般是jdk版本太低。如果是jdk7以及以下的可以更换到jdk8。

但是会有一部分人即便是jdk8任然报错,这时候你可以尝试更换你的scala版本,我一开始用的2.12.3后来换成2.10.1就可以了。

收藏 推荐 打印 | 阅读: