Dependent projects in sbt multi-project build are not recognized in editor

82 views
Skip to first unread message

Jens Rabe

unread,
Jan 18, 2017, 8:41:01 AM1/18/17
to Scala IDE User
I am currently trying out scala-ide. So I used sbteclipse plugin to generate the Eclipse project files and imported them into my workspace.


The imported projects build fine without any errors, but when I open a Scala source file in the editor, all imports from referenced projects are not found (i.e., underlined in red).


However, when I create a Java source file in the very same project and add one of the imports that fail in the Scala source, they are resolved correctly.

What is going wrong here?

Simon Schäfer

unread,
Jan 18, 2017, 8:43:32 AM1/18/17
to scala-ide-user
Is the problem resolved by restarting the presentation compiler? Can be done in right click on project > Scala > Restart PC


---- On Wed, 18 Jan 2017 14:14:15 +0100 'Jens Rabe' via Scala IDE User <scala-i...@googlegroups.com> wrote ----

--
You received this message because you are subscribed to the Google Groups "Scala IDE User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-ide-use...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jens Rabe

unread,
Jan 18, 2017, 12:04:16 PM1/18/17
to Scala IDE User
Hello,

"Restart Presentation Compiler" does nothing at all.

I am using Scala IDE 4.5 and the sbteclipse-plugin 5.1.0. My project is using Scala 2.10 with Java source level of 1.7 because I am using Spark, and some components of my project are also used with Matlab which requires Java 7.

Simon Schäfer

unread,
Jan 18, 2017, 12:58:59 PM1/18/17
to scala-ide-user



---- On Wed, 18 Jan 2017 18:04:16 +0100 'Jens Rabe' via Scala IDE User <scala-i...@googlegroups.com> wrote ----

Hello,

"Restart Presentation Compiler" does nothing at all.

I am using Scala IDE 4.5 and the sbteclipse-plugin 5.1.0. My project is using Scala 2.10 with Java source level of 1.7 because I am using Spark, and some components of my project are also used with Matlab which requires Java 7.

I forgot to ask: Does it build fine in Eclipse or only in sbt. If it doesn't compile in Eclipse, the generated Eclipse builds are broken and need to be manually adjusted. sbteclipse is not a perfect tool here.




Am Mittwoch, 18. Januar 2017 14:43:32 UTC+1 schrieb Simon Schäfer:
Is the problem resolved by restarting the presentation compiler? Can be done in right click on project > Scala > Restart PC


---- On Wed, 18 Jan 2017 14:14:15 +0100 'Jens Rabe' via Scala IDE User <scala-i...@googlegroups.com> wrote ----

I am currently trying out scala-ide. So I used sbteclipse plugin to generate the Eclipse project files and imported them into my workspace.


The imported projects build fine without any errors, but when I open a Scala source file in the editor, all imports from referenced projects are not found (i.e., underlined in red).


However, when I create a Java source file in the very same project and add one of the imports that fail in the Scala source, they are resolved correctly.

What is going wrong here?


--
You received this message because you are subscribed to the Google Groups "Scala IDE User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-ide-use...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "Scala IDE User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-ide-use...@googlegroups.com.

Jens Rabe

unread,
Jan 18, 2017, 3:51:56 PM1/18/17
to Scala IDE User

Am Mittwoch, 18. Januar 2017 18:58:59 UTC+1 schrieb Simon Schäfer:



---- On Wed, 18 Jan 2017 18:04:16 +0100 'Jens Rabe' via Scala IDE User <scala-i...@googlegroups.com> wrote ----

Hello,

"Restart Presentation Compiler" does nothing at all.

I am using Scala IDE 4.5 and the sbteclipse-plugin 5.1.0. My project is using Scala 2.10 with Java source level of 1.7 because I am using Spark, and some components of my project are also used with Matlab which requires Java 7.

I forgot to ask: Does it build fine in Eclipse or only in sbt. If it doesn't compile in Eclipse, the generated Eclipse builds are broken and need to be manually adjusted. sbteclipse is not a perfect tool here.

It builds fine with sbt, IntelliJ IDEA and in Eclipse (Clean&Rebuild works and shows no problems)

Only in the editor referenced projects are not resolved and thus things defined in them are marked as errors - but they don't appear in the Problems view.  They are just underlined in red and have the red "X" marker.

Plus, ScalaTests don't run. When I right-click a ScalaTest and select the appropriate Run command from the context menu I get a "ClassNotFoundException" complaining that this very Test class I right-clicked is missing.

I looked at the dependencies in the project properties itself (i.e., pressing Alt-Enter on the project entry, and checking the build path) and everything is there correctly. When creating a new Java class and importing something from a referenced project, this import works too. It just doesn't work for the Scala editor.

Another thing is: If the dependency comes from Maven / Ivy (i.e., "libraryDependencies" in my build.sbt file), it is correctly resolved even in the Scala editor.

If sbteclipse is not the perfect tool, are there any alternative approaches? Will direct sbt support come to Scala-IDE eventually?

Simon Schäfer

unread,
Jan 18, 2017, 5:09:05 PM1/18/17
to scala-ide-user

---- On Wed, 18 Jan 2017 21:51:56 +0100 'Jens Rabe' via Scala IDE User <scala-i...@googlegroups.com> wrote ----

If Eclipse can build everything correctly, then sbteclipse did its job well. I don't know what could cause the issues in the editor. Do you see any errors in the Error Log View or in the log (Scala > Open the Log)?

If there are no errors shown, can you share your project?

Jens Rabe

unread,
Jan 19, 2017, 3:10:38 AM1/19/17
to Scala IDE User
Unfortunately I cannot share the project because it contains a lot of company code I am not allowed to publish. But when I restart the presentation compiler, I get lots of errors like these in the log (Scala -> Open the Log):

2017-01-19 09:04:51,594  WARN [main] - org.scala-ide.sdt.core - org.scala-ide.sdt.core - org.scala-ide.sdt.core - 0 - Preference scala.compiler.sourceLevel was uninitialized for lama.exchangeformat.avro.units, setting default to 2.11.
2017-01-19 09:04:51,784 ERROR [Worker-3] - System.err - log4j:WARN No appenders could be found for logger (org.eclipse.jgit.util.FS).
2017-01-19 09:04:51,785 ERROR [Worker-3] - System.err - log4j:WARN Please initialize the log4j system properly.
2017-01-19 09:06:05,075 ERROR [Worker-5] - System.err - C:\Users\rabjen\AppData\Local\Temp\sbt_78b31e70\xsbt\ClassName.scala:16: error: not found: value enteringPhase
    enteringPhase
(currentRun.flattenPhase.next) { s fullName separator }
   
^
2017-01-19 09:06:05,080 ERROR [Worker-5] - System.err - C:\Users\rabjen\AppData\Local\Temp\sbt_78b31e70\xsbt\ClassName.scala:29: error: not found: value enteringPhase
 
protected def classNameAsSeenIn(in: Symbol, s: Symbol): String = enteringPhase(currentRun.picklerPhase.next) {
                                                                   
^
2017-01-19 09:06:05,081 ERROR [Worker-5] - System.err - C:\Users\rabjen\AppData\Local\Temp\sbt_78b31e70\xsbt\ClassName.scala:39: error: not found: value enteringPhase
    enteringPhase
(currentRun.picklerPhase.next) { s.fullName }
   
^
2017-01-19 09:06:05,082 ERROR [Worker-5] - System.err - C:\Users\rabjen\AppData\Local\Temp\sbt_78b31e70\xsbt\ClassName.scala:42: error: not found: value enteringPhase
    enteringPhase
(currentRun.picklerPhase.next) {
   
^
2017-01-19 09:06:06,128 ERROR [Worker-5] - System.err - C:\Users\rabjen\AppData\Local\Temp\sbt_78b31e70\xsbt\DelegatingReporter.scala:48: error: value finalPosition is not a member of scala.reflect.internal.util.Position
            posIn
.finalPosition
                 
^
2017-01-19 09:06:06,273 ERROR [Worker-5] - System.err - C:\Users\rabjen\AppData\Local\Temp\sbt_78b31e70\xsbt\Dependency.scala:170: error: not found: value devWarning
          devWarning
(s"No enclosing class. Discarding dependency on $dep (currentOwner = $currentOwner).")
         
^
2017-01-19 09:06:06,519 ERROR [Worker-5] - System.err - C:\Users\rabjen\AppData\Local\Temp\sbt_78b31e70\xsbt\ExtractAPI.scala:208: error: not found: value enteringPhase
    enteringPhase
(currentRun.typerPhase.next) {
   
^
2017-01-19 09:06:06,698 ERROR [Worker-5] - System.err - C:\Users\rabjen\AppData\Local\Temp\sbt_78b31e70\xsbt\ExtractAPI.scala:378: error: value getterIn is not a member of ExtractAPI.this.global.Symbol
      val getter
= sym.getterIn(sym.enclClass)
                       
^
2017-01-19 09:06:06,803 ERROR [Worker-5] - System.err - C:\Users\rabjen\AppData\Local\Temp\sbt_78b31e70\xsbt\ExtractAPI.scala:616: error: value unexpandedName is not a member of ExtractAPI.this.global.Symbol
      val n
= s.unexpandedName
               
^
2017-01-19 09:06:06,862 ERROR [Worker-5] - System.err - C:\Users\rabjen\AppData\Local\Temp\sbt_78b31e70\xsbt\ExtractUsedNames.scala:145: error: value hasSymbolField is not a member of ExtractUsedNames.this.global.Tree
     
case t if t.hasSymbolField =>
                 
^
2017-01-19 09:06:06,915 ERROR [Worker-5] - System.err - C:\Users\rabjen\AppData\Local\Temp\sbt_78b31e70\xsbt\GlobalHelpers.scala:21: error: type MacroExpansionAttachment is not a member of scala.tools.nsc.typechecker.Analyzer{val global: GlobalHelpers.this.global.type}
       
case att: analyzer.MacroExpansionAttachment => att.expandee
                           
^
2017-01-19 09:06:06,918 ERROR [Worker-5] - System.err - C:\Users\rabjen\AppData\Local\Temp\sbt_78b31e70\xsbt\GlobalHelpers.scala:21: error: value expandee is not a member of Any
       
case att: analyzer.MacroExpansionAttachment => att.expandee
                                                           
^
2017-01-19 09:06:06,995 ERROR [Worker-5] - System.err - 12 errors found

Jens Rabe

unread,
Jan 19, 2017, 5:13:24 AM1/19/17
to Scala IDE User
Follow up:

I googled some of the error messages and this post in the same group came up. So I gave it a try and switched the Scala version to 2.11, and now everything works. I think my problem is related to the bug in the linked post.

Simon Schäfer

unread,
Jan 19, 2017, 6:29:03 AM1/19/17
to scala-ide-user



---- On Thu, 19 Jan 2017 11:13:24 +0100 'Jens Rabe' via Scala IDE User <scala-i...@googlegroups.com> wrote ----

Follow up:

I googled some of the error messages and this post in the same group came up. So I gave it a try and switched the Scala version to 2.11, and now everything works. I think my problem is related to the bug in the linked post.

Indeed, there was a bug with using 2.10. We already fixed it, it is in the nightly build if you want to try it. If you can move from 2.10 to 2.11 permanently I recommend you are going to do the transition.

Jens Rabe

unread,
Feb 19, 2017, 7:40:47 AM2/19/17
to Scala IDE User
Just a followup.

I think I found a feasible workaround. I pulled my project to 2.11, but enabled cross-build, so I can compile the stuff that is to run on Spark for 2.10 (as I am currently using Spark 1.6.2 on HDP which is still built against Scala 2.10).

Now I only have a problem ScalaTest recognizing the wrong version of Guava although I forced to evict this to at least 16.0.1 so the tests involving Spark don't run from Eclipse. They do, however, work in IntelliJ IDEA and from command line when running sbt test. I can live with this for now.
Reply all
Reply to author
Forward
0 new messages