Issue while building project in scalaide

661 views Asked by At

I am using scala IDE eclipse version 4.4.0 with Scala 2.11.8. I am able to compile the project from command line using sbt compile and create eclipse specific project files using sbt eclipse (using sbteclipse for this). However , while I am clicking on build project in context menu ,its giving exception

**Errors occurred during the build.
Errors running builder 'Scala Builder' on project project_name.
org.eclipse.core.internal.resources.File cannot be cast to org.eclipse.core.resources.IContainer**

Here the error log of the same .

**!ENTRY org.scala-ide.sdt.core 4 0 2017-01-09 14:13:56.020
!MESSAGE Error thrown while initializing the presentation compiler.
!STACK 0
java.lang.ClassCastException: org.eclipse.core.internal.resources.File cannot be cast to org.eclipse.core.resources.IContainer
    at org.scalaide.core.internal.project.ScalaProject$$anonfun$sourceOutputFolders$2$$anonfun$apply$7.apply(ScalaProject.scala:242)
    at org.scalaide.core.internal.project.ScalaProject$$anonfun$sourceOutputFolders$2$$anonfun$apply$7.apply(ScalaProject.scala:232)
    at scala.Option$WithFilter.map(Option.scala:207)
    at org.scalaide.core.internal.project.ScalaProject$$anonfun$sourceOutputFolders$2.apply(ScalaProject.scala:232)
    at org.scalaide.core.internal.project.ScalaProject$$anonfun$sourceOutputFolders$2.apply(ScalaProject.scala:231)
    at scala.collection.TraversableLike$WithFilter$$anonfun$flatMap$2.apply(TraversableLike.scala:714)
    at scala.collection.immutable.List.foreach(List.scala:381)
    at scala.collection.TraversableLike$WithFilter.flatMap(TraversableLike.scala:713)
    at org.scalaide.core.internal.project.ScalaProject.sourceOutputFolders(ScalaProject.scala:231)
    at org.scalaide.core.internal.project.ScalaProject.initializeCompilerSettings(ScalaProject.scala:478)
    at org.scalaide.core.internal.project.ScalaProject.org$scalaide$core$internal$project$ScalaProject$$prepareCompilerSettings(ScalaProject.scala:435)
    at org.scalaide.core.internal.project.ScalaProject$$anonfun$5.apply(ScalaProject.scala:159)
    at org.scalaide.core.internal.project.ScalaProject$$anonfun$5.apply(ScalaProject.scala:159)
    at org.scalaide.core.internal.compiler.PresentationCompilerProxy.liftedTree1$1(PresentationCompilerProxy.scala:152)
    at org.scalaide.core.internal.compiler.PresentationCompilerProxy.create(PresentationCompilerProxy.scala:151)
    at org.scalaide.core.internal.compiler.PresentationCompilerProxy.initialize(PresentationCompilerProxy.scala:116)
    at org.scalaide.core.internal.compiler.PresentationCompilerProxy.obtainPc$1(PresentationCompilerProxy.scala:78)
    at org.scalaide.core.internal.compiler.PresentationCompilerProxy.internal(PresentationCompilerProxy.scala:98)
    at org.scalaide.core.internal.jdt.model.ScalaCompilationUnit$class.addToIndexer(ScalaCompilationUnit.scala:157)
    at org.scalaide.core.internal.jdt.model.ScalaSourceFile.addToIndexer(ScalaSourceFile.scala:66)
    at org.scalaide.core.internal.jdt.search.ScalaSourceIndexer$$anonfun$indexDocument$2.apply(ScalaSourceIndexer.scala:16)
    at org.scalaide.core.internal.jdt.search.ScalaSourceIndexer$$anonfun$indexDocument$2.apply(ScalaSourceIndexer.scala:16)
    at scala.Option.map(Option.scala:146)
    at org.scalaide.core.internal.jdt.search.ScalaSourceIndexer.indexDocument(ScalaSourceIndexer.scala:16)
    at scala.tools.eclipse.contribution.weaving.jdt.indexerprovider.IndexerProviderAspect.ajc$around$scala_tools_eclipse_contribution_weaving_jdt_indexerprovider_IndexerProviderAspect$1$16276a3c(IndexerProviderAspect.aj:30)
    at org.eclipse.jdt.internal.core.search.JavaSearchParticipant.indexDocument(JavaSearchParticipant.java:71)
    at org.eclipse.jdt.internal.core.search.indexing.IndexManager.indexDocument(IndexManager.java:504)
    at org.eclipse.jdt.internal.core.search.indexing.IndexManager$1.execute(IndexManager.java:984)
    at org.eclipse.jdt.internal.core.search.processing.JobManager.run(JobManager.java:405)
    at java.lang.Thread.run(Thread.java:745)**
1

There are 1 answers

0
howlger On

Your Scala IDE Eclipse plug-in fails by using internal classes instead of public API from Eclipse (ClassCastException of org.eclipse.....internal.... classes in org.scalaide....). This could be caused by using an older version of the Scala plug-in in a newer version of Eclipse.

Either use the latest version of both, of Eclipse and of the Scala IDE plug-in or use the Scala IDE which contains Eclipse, Scala and the Scala plug-in of versions which have been tested together.