Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error building Intellij Scala Plugin

I am trying to follow the instructions at

https://confluence.jetbrains.com/display/SCA/Setting+up+Scala+plugin+project+in+IntelliJ+IDEA

I am using Idea 14.1.14. Have downloaded the sources and downloadIdea. And after importing the project set the Project SDK to 1.7.

Not sure if the above is enough info to go on; but on make project I get the below error; is it possible to guess at what I've got incorrect?

Error:scalac: error while loading Object, Missing dependency 'object scala in compiler mirror', required by /usr/lib/jvm/java-7-oracle/jre/lib/rt.jar(java/lang/Object.class)
Error:scalac: Error: object scala in compiler mirror not found.
scala.reflect.internal.MissingRequirementError: object scala 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.getPackage(Mirrors.scala:173)
    at scala.reflect.internal.Definitions$DefinitionsClass.ScalaPackage$lzycompute(Definitions.scala:161)
    at scala.reflect.internal.Definitions$DefinitionsClass.ScalaPackage(Definitions.scala:161)
    at scala.reflect.internal.Definitions$DefinitionsClass.ScalaPackageClass$lzycompute(Definitions.scala:162)
    at scala.reflect.internal.Definitions$DefinitionsClass.ScalaPackageClass(Definitions.scala:162)
    at scala.reflect.internal.Definitions$DefinitionsClass.init(Definitions.scala:1377)
    at scala.tools.nsc.Global$Run.<init>(Global.scala:1229)
    at xsbt.CachedCompiler0$$anon$2.<init>(CompilerInterface.scala:116)
    at xsbt.CachedCompiler0.run(CompilerInterface.scala:116)
    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: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: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)
Warning:scalac: No 'scala-library*.jar' in module dependencies [compiler_settings]
like image 402
brent Avatar asked Dec 14 '22 12:12

brent


2 Answers

Go to File -> Project structure -> Global libraries and add Scala SDK there. In my case, two SDKs were already present (in ivy folder) and offered for selection.

like image 127
Željko Trogrlić Avatar answered Dec 17 '22 01:12

Željko Trogrlić


I have faced a similar issue recently even after having the compatible versions of java,sbt and scala SDK but found few reasons why we get this error when we importing sbt project into Intellij.

  1. Check the scala-SDK is present in the global libraries under File->Project Structure -> Global Libraries.

Please find the below screenshot.

Intellij global library settings

  1. Even after fixing the first issue you still face this issue. Then look for the external dependencies which you have placed under /lib folder check the checksum of that jar if possible are make sure it has the right size. This should solve the issue.

external libarires

Apart from the above issue, you might end up with dependencies source linking issues in the code when you open the project in IntelliJ. This is because of the additional root modules which are present under File -> Project modules -> modules. In the modules panel, you will see projectxxx-src and projectxx-test additional to projexctxx-process and projectxx-process-build. So remove the projectxx-src and projectxx-test.

Remove additional modules

like image 22
iloveindia Avatar answered Dec 17 '22 00:12

iloveindia