Intellij is not finding my scala classes

3,952 views
Skip to first unread message

Eric Fowler

unread,
Dec 19, 2014, 1:48:15 AM12/19/14
to scala...@googlegroups.com
I recently installed Intellij on my Windows machine, and sucked down my project from a git repo. I installed the JDK, and opened my project. 

All of my classes are tagged in red, and the 'Cannot resolve symbol <my class>' appears everywhere. Such words as collection and contains are also red. 

The files containing the classes are all in the same folder. I have the Scala/SBT plugin installed. I have used Idea to work on this project on another machine already. 

What is wrong? This should be easy. 

Thanks

scala solist

unread,
Dec 19, 2014, 2:01:54 AM12/19/14
to scala...@googlegroups.com
IntelliJ IDEA only partially supports sbt projects. It ignores scala files in base folder and corresponding sbt variable sourcesInBase.

Eric Fowler

unread,
Dec 19, 2014, 10:57:23 AM12/19/14
to scala...@googlegroups.com
OK. So how do I point it at those classes?

Eric

scala solist

unread,
Dec 20, 2014, 8:39:41 AM12/20/14
to scala...@googlegroups.com
create the structure that IDEA can understand (src/main/scala) and relocate your files there. Or stop using IDE that does not support your project configuration.


On Friday, December 19, 2014 9:48:15 AM UTC+3, Eric Fowler wrote:

Eric Fowler

unread,
Dec 24, 2014, 11:42:05 PM12/24/14
to scala...@googlegroups.com
Sorry to say but I am still not past this. 

I created a new project using the scala/sbt option. I copied my code into mumble\src\main\scala and mumble\src\test\scala. The IDE now sees all external Scala and Java classes, but my imports - all of them in Scala, and all in the same directory - are invisible. 

Are you saying this file configuration should be used without SBT? The IDE created that directory structure. What are the advantages / disadvantages of SBT vs. a "puer" scala project?

Thanks

Eric

kcwill

unread,
Dec 25, 2014, 2:50:56 AM12/25/14
to scala...@googlegroups.com
Your file structure sounds correct.

Does it compile from intellij's sbt console window?

Are you getting any errors when you refresh the project from the sbt tool window?

I've had a similar issue where intellij points to an invalid jdk in sbt.xml and also when intellij can't start sbt do to memory availability. In these cases intellij complains in the event window.


Eric Fowler

unread,
Dec 25, 2014, 10:36:52 PM12/25/14
to scala...@googlegroups.com
I can't even *find* Intellij's SBT console window. :-(

Refreshing from the tool window, no errors. 

When I make, it gives me this:

Error:scalac: Output path C:\Users\Eric\Shuttle\out\test\Routing is shared between: Module 'Routing' tests, Module 'routing' tests
Output path C:\Users\Eric\Shuttle\out\production\Routing is shared between: Module 'Routing' production, Module 'routing' production
Please configure separate output paths to proceed with the compilation.
TIP: you can use Project Artifacts to combine compiled classes if needed.

Not finding Project Artifacts, admit I haven't tried very hard. I always capitalize my Module And File Names, so I don't know where the lowercase 'routing' comes from. 

Let me say that the project has evolved a little from my first post. I built a dummy SBT project in IDEA, and copied the Scala. files into the appropriate sub-directories, then built.

What is the easiest way to build a Scala project in IDEA? Should I go through this pain with SBT or not?

Any opinions?

Eric

Roman Janusz

unread,
Dec 27, 2014, 4:25:40 PM12/27/14
to scala...@googlegroups.com
I recall reading somewhere that IDEA 14 (or Scala plugin for it) has a bug that causes such random inability to find classes (can't find the link now).
The workaround was to do File -> Invalidate Caches / Restart...

Jaroslaw Rozanski

unread,
Dec 28, 2014, 2:03:18 PM12/28/14
to scala...@googlegroups.com
Hi Eric,

So did you 
1) import project by using project files generated using sbt IDEA plugin?
2) open project by pointing it at build.sbt file in your project?

Option #1 is problematic for me. Might be related to sbt version 0.13.7 and plugin version I have.
Option #2 is failing IF I don't specify explicit path to sbt-launch.jar (one of option when creating new project from existing build.sbt)

The above was tested with IDEA 14 CE and SBT 0.13.7, Scala 2.11.4.

Hope that helps.

Eric Fowler

unread,
Dec 30, 2014, 1:15:05 AM12/30/14
to scala...@googlegroups.com
(1), yes; (2), no. I fixed (2) and things are a bit better now. Also my scalatest jar was in the wrong place. 

Still have colorcoding problems but it is building. 

Now if I can just RUN the damn thing ... 

Eric
Reply all
Reply to author
Forward
0 new messages