运行Scala项目时出错 - 未找到编译器镜像中的类scala.deprecatedInheritance

时间:2014-09-08 10:24:55

标签: scala goose

我是java和Scala的新手。 我已经下载了IntelliJ 13.1,我试图按原样运行这个项目(Goose文本提取器):https://github.com/GravityLabs/goose

我使用JDK 1.7.0_67进行这些项目结构设置:

enter image description here 当我试图运行文件TalkToMeGoose.scala我得到这个错误:

Error:scalac: Error: class scala.deprecatedInheritance in compiler mirror not found. scala.reflect.internal.MissingRequirementError: class scala.deprecatedInheritance in compiler mirror not found.

at scala.reflect.internal.MissingRequirementError$.signal(MissingRequirementError.scala:17)
at scala.reflect.internal.MissingRequirementError$.notFound(MissingRequirementError.scala:18)

at scala.reflect.internal.Mirrors$RootsBase.getModuleOrClass(Mirrors.scala:53)

at scala.reflect.internal.Mirrors$RootsBase.getModuleOrClass(Mirrors.scala:66)

at scala.reflect.internal.Mirrors$RootsBase.getClassByName(Mirrors.scala:102)

at scala.reflect.internal.Mirrors$RootsBase.getRequiredClass(Mirrors.scala:105)

at scala.reflect.internal.Mirrors$RootsBase.requiredClass(Mirrors.scala:108)

at scala.reflect.internal.Definitions$DefinitionsClass.DeprecatedInheritanceAttr$lzycompute(Definitions.scala:1101)

at scala.reflect.internal.Definitions$DefinitionsClass.DeprecatedInheritanceAttr(Definitions.scala:1101)

at scala.reflect.internal.Symbols$Symbol.hasDeprecatedInheritanceAnnotation(Symbols.scala:842)

at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$validateParentClass$1(Typers.scala:1675)

at scala.tools.nsc.typechecker.Typers$Typer.validateParentClasses(Typers.scala:1706)

at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:1864)

at scala.tools.nsc.typechecker.Typers$Typer.typedClassDef(Typers.scala:1738)

at scala.tools.nsc.typechecker.Typers$Typer.typedMemberDef$1(Typers.scala:5206)

at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5256)

at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5293)

at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedInternal(Typers.scala:5320)

at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5267)

at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5271)

at scala.tools.nsc.typechecker.Typers$Typer.typedByValueExpr(Typers.scala:5349)

at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedStat$1(Typers.scala:2985)

at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$61.apply(Typers.scala:3089)

at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$61.apply(Typers.scala:3089)

at scala.collection.immutable.List.loop$1(List.scala:172)

at scala.collection.immutable.List.mapConserve(List.scala:188)

at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:3089)

at scala.tools.nsc.typechecker.Typers$Typer.typedPackageDef$1(Typers.scala:4916)

at scala.tools.nsc.typechecker.Typers$Typer.typedMemberDef$1(Typers.scala:5209)

at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5256)

at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5293)

at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedInternal(Typers.scala:5320)

at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5267)

at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5271)

at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5345)

at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.apply(Analyzer.scala:102)

at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:410)

at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3$$anonfun$run$1.apply(Analyzer.scala:94)

at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3$$anonfun$run$1.apply(Analyzer.scala:93)

at scala.collection.Iterator$class.foreach(Iterator.scala:743)

at scala.collection.AbstractIterator.foreach(Iterator.scala:1177)

at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.run(Analyzer.scala:93)

at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1557)

at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1542)

at scala.tools.nsc.Global$Run.compileSources(Global.scala:1537)

at scala.tools.nsc.Global$Run.compile(Global.scala:1644)

at xsbt.CachedCompiler0.run(CompilerInterface.scala:126)

at xsbt.CachedCompiler0.run(CompilerInterface.scala:102)

at xsbt.CompilerInterface.run(CompilerInterface.scala:27)

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

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

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

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

at sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:102)

at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:48)

at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:41)

at org.jetbrains.jps.incremental.scala.local.IdeaIncrementalCompiler.compile(IdeaIncrementalCompiler.scala:28)

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

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

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

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

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

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

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

无法在Google上找到任何相关信息......

2 个答案:

答案 0 :(得分:1)

所以要恢复我的评论:

您应该使用的编译器库是:Maven: org.scala-lang:scala-compiler-bundle:2.9.0-1

我不知道为什么在打开Goose项目时没有创建它。

但你可以自己创建它:

打开库设置,点击例如:Maven: org.scala-lang:scala-library:2.9.0-1,找到系统下载maven库的位置。

然后点击New Project Library,并添加Maven: org.scala-lang:scala-library:2.9.0-1Maven: org.scala-lang:scala-compiler:2.9.0-1。文件选择器有一个显示隐藏目录的选项,这可能很有用。

然后进入Module设置并将Scala编译器更改为刚刚创建的库。 (出现在库列表中可能需要几秒钟)。 它应该工作正常。

答案 1 :(得分:0)

我可以在命令行上使用maven编译goose。它需要Scala 2.9.0。请检查IDEA 13.1使用的Scala编译器的版本。如果存在版本差异,则可能会出现此类错误。请参阅http://grokbase.com/t/gg/scala-ide-user/143ntm6n3p/switching-scala-library-version-to-match-project