0

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

我将 JDK 1.7.0_67 与这些项目结构设置一起使用:

在此处输入图像描述 当我尝试运行文件 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 上找不到任何相关内容...

4

2 回答 2

1

所以恢复我的评论:

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

不知道为什么你打开 Goose 项目的时候还没有创建。

但是您可以自己创建它:

打开库设置并通过单击例如:找到您的系统下载 maven 库的位置:Maven: org.scala-lang:scala-library:2.9.0-1

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

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

于 2014-09-08T13:13:51.313 回答
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

于 2014-09-08T10:47:54.717 回答