14

The breeze project builds fine from command line sbt:

sbt package
...
info] Done packaging.
[info] Packaging /shared/breeze/viz/target/scala-2.11/breeze-viz_2.11-0.11-SNAPSHOT.jar ...
[info] Done packaging.
[success] Total time: 238 s, completed Jan 27, 2015 9:40:03 AM

However , the following error comes up repeatedly when doing Build|Rebuild Project in IntelliJ IDEA 14:

Error:scalac: error while loading Object, Missing dependency 'object scala in compiler mirror', required by /Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/Contents/Home/jre/lib/rt.jar(java/lang/Object.class)

Here is the full stacktrace:

Error:scalac: Error: scala.tools.nsc.typechecker.Namers$Namer.enterExistingSym(Lscala/reflect/internal/Symbols$Symbol;)Lscala/tools/nsc/typechecker/Contexts$Context;
java.lang.NoSuchMethodError: scala.tools.nsc.typechecker.Namers$Namer.enterExistingSym(Lscala/reflect/internal/Symbols$Symbol;)Lscala/tools/nsc/typechecker/Contexts$Context;
    at org.scalamacros.paradise.typechecker.Namers$Namer$class.enterSym(Namers.scala:41)
    at org.scalamacros.paradise.typechecker.Namers$$anon$3.enterSym(Namers.scala:13)
    at org.scalamacros.paradise.typechecker.AnalyzerPlugins$MacroPlugin$.pluginsEnterSym(AnalyzerPlugins.scala:35)
    at scala.tools.nsc.typechecker.AnalyzerPlugins$$anon$13.custom(AnalyzerPlugins.scala:429)
    at scala.tools.nsc.typechecker.AnalyzerPlugins$$anonfun$2.apply(AnalyzerPlugins.scala:371)
    at scala.tools.nsc.typechecker.AnalyzerPlugins$$anonfun$2.apply(AnalyzerPlugins.scala:371)
    at scala.collection.immutable.List.map(List.scala:273)
    at scala.tools.nsc.typechecker.AnalyzerPlugins$class.invoke(AnalyzerPlugins.scala:371)
    at scala.tools.nsc.typechecker.AnalyzerPlugins$class.pluginsEnterSym(AnalyzerPlugins.scala:423)
    at scala.tools.nsc.Global$$anon$1.pluginsEnterSym(Global.scala:463)
    at scala.tools.nsc.typechecker.Namers$Namer.enterSym(Namers.scala:274)
    at scala.tools.nsc.typechecker.Namers$Namer$$anonfun$enterSyms$1.apply(Namers.scala:500)
    at scala.tools.nsc.typechecker.Namers$Namer$$anonfun$enterSyms$1.apply(Namers.scala:499)
    at scala.collection.LinearSeqOptimized$class.foldLeft(LinearSeqOptimized.scala:124)
    at scala.collection.immutable.List.foldLeft(List.scala:84)
    at scala.tools.nsc.typechecker.Namers$Namer.enterSyms(Namers.scala:499)
    at scala.tools.nsc.typechecker.Namers$Namer.templateSig(Namers.scala:925)
    at scala.tools.nsc.typechecker.Namers$Namer.moduleSig(Namers.scala:989)
    at scala.tools.nsc.typechecker.Namers$Namer.getSig$1(Namers.scala:1526)
    at scala.tools.nsc.typechecker.Namers$Namer.typeSig(Namers.scala:1541)
    at scala.tools.nsc.typechecker.Namers$Namer$$anonfun$monoTypeCompleter$1$$anonfun$apply$1.apply$mcV$sp(Namers.scala:781)
    at scala.tools.nsc.typechecker.Namers$Namer$$anonfun$monoTypeCompleter$1$$anonfun$apply$1.apply(Namers.scala:780)
    at scala.tools.nsc.typechecker.Namers$Namer$$anonfun$monoTypeCompleter$1$$anonfun$apply$1.apply(Namers.scala:780)
    at scala.tools.nsc.typechecker.Namers$Namer.scala$tools$nsc$typechecker$Namers$Namer$$logAndValidate(Namers.scala:1568)
    at scala.tools.nsc.typechecker.Namers$Namer$$anonfun$monoTypeCompleter$1.apply(Namers.scala:780)
    at scala.tools.nsc.typechecker.Namers$Namer$$anonfun$monoTypeCompleter$1.apply(Namers.scala:772)
    at scala.tools.nsc.typechecker.Namers$$anon$1.completeImpl(Namers.scala:1684)
    at scala.tools.nsc.typechecker.Namers$LockingTypeCompleter$class.complete(Namers.scala:1692)
    at scala.tools.nsc.typechecker.Namers$$anon$1.complete(Namers.scala:1682)
    at scala.reflect.internal.Symbols$Symbol.info(Symbols.scala:1483)
    at scala.reflect.internal.SymbolTable.openPackageModule(SymbolTable.scala:286)
    at scala.tools.nsc.typechecker.Analyzer$packageObjects$$anon$2$$anon$4.traverse(Analyzer.scala:63)
    at scala.tools.nsc.typechecker.Analyzer$packageObjects$$anon$2$$anon$4.traverse(Analyzer.scala:59)
    at scala.reflect.api.Trees$Traverser$$anonfun$traverseStats$1$$anonfun$apply$1.apply$mcV$sp(Trees.scala:2498)
    at scala.reflect.api.Trees$Traverser.atOwner(Trees.scala:2507)
    at scala.reflect.api.Trees$Traverser.traverseStats(Trees.scala:2497)
    at scala.reflect.internal.Trees$class.itraverse(Trees.scala:1326)
    at scala.reflect.internal.SymbolTable.itraverse(SymbolTable.scala:16)
    at scala.reflect.internal.SymbolTable.itraverse(SymbolTable.scala:16)
    at scala.reflect.api.Trees$Traverser.traverse(Trees.scala:2475)
    at scala.tools.nsc.typechecker.Analyzer$packageObjects$$anon$2$$anon$4.traverse(Analyzer.scala:66)
    at scala.tools.nsc.typechecker.Analyzer$packageObjects$$anon$2$$anon$4.traverse(Analyzer.scala:59)
    at scala.reflect.api.Trees$Traverser$$anonfun$traverseStats$1$$anonfun$apply$1.apply$mcV$sp(Trees.scala:2498)
    at scala.reflect.api.Trees$Traverser.atOwner(Trees.scala:2507)
    at scala.reflect.api.Trees$Traverser.traverseStats(Trees.scala:2497)
    at scala.reflect.internal.Trees$class.itraverse(Trees.scala:1326)
    at scala.reflect.internal.SymbolTable.itraverse(SymbolTable.scala:16)
    at scala.reflect.internal.SymbolTable.itraverse(SymbolTable.scala:16)
    at scala.reflect.api.Trees$Traverser.traverse(Trees.scala:2475)
    at scala.tools.nsc.typechecker.Analyzer$packageObjects$$anon$2$$anon$4.traverse(Analyzer.scala:66)
    at scala.tools.nsc.typechecker.Analyzer$packageObjects$$anon$2$$anon$4.traverse(Analyzer.scala:59)
    at scala.reflect.api.Trees$Traverser.apply(Trees.scala:2513)
    at scala.tools.nsc.typechecker.Analyzer$packageObjects$$anon$2.apply(Analyzer.scala:71)
    at scala.tools.nsc.Global$GlobalPhase$$anonfun$applyPhase$1.apply$mcV$sp(Global.scala:441)
    at scala.tools.nsc.Global$GlobalPhase.withCurrentUnit(Global.scala:432)
    at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:441)
    at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:399)
    at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:399)
    at scala.collection.Iterator$class.foreach(Iterator.scala:750)
    at scala.collection.AbstractIterator.foreach(Iterator.scala:1202)
    at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:399)
    at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1500)
    at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1487)
    at scala.tools.nsc.Global$Run.compileSources(Global.scala:1482)
    at scala.tools.nsc.Global$Run.compile(Global.scala:1580)
    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:29)
    at org.jetbrains.jps.incremental.scala.local.LocalServer.compile(LocalServer.scala:26)
    at org.jetbrains.jps.incremental.scala.remote.Main$.make(Main.scala:65)
    at org.jetbrains.jps.incremental.scala.remote.Main$.nailMain(Main.scala:23)
    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)
Jacek Laskowski
  • 72,696
  • 27
  • 242
  • 420
WestCoastProjects
  • 58,982
  • 91
  • 316
  • 560
  • See http://stackoverflow.com/questions/23317326/trying-to-cross-compile-a-project-to-scala-2-11-fails-with-error-while-loading – Nick Jacobs Feb 20 '15 at 12:49
  • @NickJacobs That other question does not apply for at least two reasons. (a) as mentioned in the OP: the compilation works on the command line (Build.scala is not broken!) (b) did you actually look at breeze build.sbt? It does not override common (and I have not touched it) – WestCoastProjects Feb 20 '15 at 15:41
  • The same happens to me in Eclipse. – Carsten Mar 13 '15 at 11:06
  • Try turning off incremental compilation? Just a thought. Scala IDEs try to save time by optimizing the compile process. Also a recent problem I've had with intellij is that it hasn't been updating dependencies properly. Try removing the `.idea` folder and reimporting the project. Just some heuristics that might help – Ritwik Bose Apr 02 '15 at 15:05
  • @mechko I do not have incremental compilation turned on. I have gone through nuking the .idea folder several times also. Thanks anyways for the thoughts. – WestCoastProjects Apr 02 '15 at 15:19
  • I mentioned incremental because I saw it somewhere in the stack trace (near the bottom). I feel your pain, most vividly. – Ritwik Bose Apr 02 '15 at 15:31
  • @mechko Well this is explicitly during Project|Rebuild so incremental compilation does not apply in this case. – WestCoastProjects Apr 02 '15 at 15:41
  • Also just noticed. Jdk version on intelliji is 1.7. That might be different from the terminal – Ritwik Bose Apr 02 '15 at 15:48
  • @mechko jdk version on terminal is 1.7.0.25. Have you been successful to build this in IJ? – WestCoastProjects Apr 02 '15 at 15:54
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/74360/discussion-between-mechko-and-javadba). – Ritwik Bose Apr 02 '15 at 16:08
  • It's hard to guess the full scope of what you're seeing... the first error that you list ("`error while loading object`") isn't in the stack trace. What is the relationship between the error and the stack trace? This looks like a tooling classpath version skew of some kind - or maybe even two of them. – Ed Staub Apr 14 '15 at 03:39
  • Also, if you haven't already, take a look at https://groups.google.com/forum/#!topic/scala-ide-user/QlRRDcz-s5o – Ed Staub Apr 14 '15 at 03:40
  • @EdStaub That is for the scala-ide: this question is for Intellij – WestCoastProjects Apr 14 '15 at 15:13

2 Answers2

3

There's a version mismatch between the Scala compiler and the macro paradise version. Macro-paradise is a compiler plugin and is tightly coupled to the Scala compiler, so it's cross-compiled against a full Scala version. Check the version of Scala that IntelliJ uses and check what Scala version is macro-paradise compiled against.

Not sure exactly how Intellij works, but in Eclipse there's a "Scala Installation" configuration page (similar to JDK). You can set a Scala Installation that matches the paradise version. Maybe IntelliJ has a similar concept.

Iulian Dragos
  • 5,692
  • 23
  • 31
0

enter image description here

For my case, I switch to JDK8, now it builds successfully.

HHH
  • 311
  • 2
  • 7