IntelliJ IDEA w/ Scala Plugin not finding scala.concurrent - scala

I am having the hardest time getting a fresh install of IntelliJ to work properly with Scala.
I've installed IntelliJ IDEA 13.1.4 and the Scala plugin on a Mac. In any project, the IDE complains it cannot find scala.concurrent (or any other package in scala-library) even though the library is listed under "External Libraries". What am I missing?
I've got the basic steps to reproduce down to:
Install IntelliJ IDEA 13.1.4
Install Scala plugin via IntelliJ plugins dialog
Create a new Scala project (either SBT or non-SBT, doesn't matter)
Define a new class and try to import scala.concurrent._
This happens with new or existing projects - even when provisioned via sbt gen-idea.
I've installed Scala and SBT via brew and even tried setting $SCALA_HOME to point to the brew install of scala (/usr/local/share/scala).
IntelliJ is listing the library in External Libraries but still can't resolve the symbol.
I have been fighting with this for hours. What am I missing here?

I had the same issue. I fixed it with Invalidate Caches
File | Invalidate Caches / restart. Manual way on Mac with removing this folder:
~/Library/Caches/IntelliJIDEAXX

I had the same issue and above advice didn't help me. After googling and reading JetBrains tickets, I found out that I had $JAVA_HOME variable pointing to JDK 1.7:
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home
Removing that from both current shell (unset JAVA_HOME) and shell's profile (in my case .zshrc) resolved the issue.

Related

IntelliJ IDEA 2020.3 Scala plugin isn't working with new projects

I just formatted my computer and installed the new macOS Big Sur. I installed IntelliJ IDEA 2020.3 with the Scala plugin version 2020.3.17. I'm running GraalVM 20.3, Scala 2.13.4 and sbt 1.4.4 outside IntelliJ with no issues so far.
IntelliJ loads my projects just fine and everything works perfectly. The problem is when I try to create a new Scala/sbt project. IntelliJ isn't creating the build module as expected and, because of that, IntelliJ doesn't recognize any source code at all.
All installs were clean, I didn't recovered from any backup, just installed as it was a new computer. I also own a valid IntelliJ IDEA Ultimate license. I tried uninstalling everything, but with no success. There's no way I can make it work.
The steps to reproduce my issue:
Open IntelliJ IDEA -> New project -> Select Scala on the left panel -> Select sbt on the right panel -> All defaults on next screen -> Wait for IntelliJ to index everything and creates the modules.
That's it. After finishing indexing, no build module is created. If I open my build.sbt file, all it shows is it can't find any symbol and it doesn't highlight the src/main/scala as source code folder. Actually, it doesn't highlight any folder at all.
Anyone out there with the same issue and/or solution?
Yes, I had the same problem as you. I rebuilt the project step by step by creating a new one starting from the sbt dependencies and plugins. Basically I solved it by setting the sbt version to sbt.version = 0.13.18 inside the project / build.properties folder. By inserting scala-sdk-2.12.12 as global libraries in the project structure and Java 12 as SDK
This issue is gone with latest updates from IntelliJ.

intellij error while importing SBT project

I recently installed IntelliJ on Ubuntu 16.04, but I'm getting this error while trying to start a Scala project:
This is my first linux computer, and I installed the oracle 8 jdk through the package manager, not sure if it's something wrong with this configuration or something else. Am I missing some java variables? When I installed intellij before on Windows the scala package came with basically everything I needed, and I used the jdk windows installer.
I think your Intellij is missing the Scala SDK. Usually it would be picked during first time setup.
Open "Open Module Settings" of your project (by right-click), go to libraries, add an Scala SDK.
Hope it should fix your problem.

Installing a scala "ecosystem" on Linux (debian)?

Newbie to scala.
Reading some descriptions of how to install a scala ecosystem has me confused. I will be installing on a apt-based linux system. My choice of editor/ide will be emacs ( though I might play with Eclipse and IntelliJ ).
Not a java programmer. I also like to do projects as different users for different purposes.
From what I understand the steps are:
Install sbt from the linux distro repo as root.
Install the newest sbt from the installed sbt as root.
Install the newest scala from sbt as root.
Install ensime from sbt as root.
( or do I install it from melpa? )
Also I heard of something called Scala Worksheet which might be useful. The version I heard of is a Eclipse plusin. Is there a version that can be used with emacs?
You can install ensime as normal user from MELPA without problems. Just read carefully the instructions in their web page. It is important to install the ensime SBT plugin in the user directory instead of the project plugin directory.
The ensime integration works way better that Eclipse's Scala IDE.
About the worskheet, it would be nice to have it in emacs but it is not really needed . You can work quite fine just with sbt.

IntelliJ 14 - Create / Import a Scala / SBT project

IntelliJ 14 supports (in theory) SBT / Scala projects through the Scala plugin, which is still available in the official repo. According to this post "Scala plugin project itself now uses SBT for build and dependency management". However I cannot find any way to create or import a SBT / Scala project with IntelliJ. There is also a lack of documentation explaining more about this new way of configuring the Scala Plugin.
I have the Scala plugin activated in the IntelliJ Ultimate 14.0 (139.224). Any ideas?
Install scala plugin. Settings -> Plugins -> Scala -> Install
Open directory with sbt build: File -> Open Project -> select directory with build.sbt -> configure settings
That worked for me just a couple of minutes ago. It may be necessary to reset cache and restart: File -> Invalidate Caches / Restart.
I've finally figured out the exact problem. IntelliJ loaded the default settings of the previous version, including the old version of the Scala plugin. The problem was fixed uninstalling the old Scala plugin and following the steps posted by Eugene Zhulenev
Make sure you have the scala plugin for intellij.
Go file>new>'project from existing source', select your project to import.
Go to build.sbt and there should be a prompt to import the packages.
Sometimes, you can try to file>synchronise or file>'invalidate cache and restart'.
I tried the following steps but they didn't help:
Invalidate cache and restart IntelliJ
Close the project and re-import the project
Uninstall the Scala plugin and reinstall it
Eventually, I removed the target folders in the project, and re-imported it. Then it worked.

Scala Eclipse IDE - strange behavior

I am giving a try to Scala Eclipse IDE after a very long time. I installed Eclipse and the said Scala plugin only a while ago, but I am unable to get stuff working. In all of the Scala files, I get the errors like following (See the tooltip):
This project uses Gradle for building, and I also have the latest version of Groovy plugin installed. Please help me get this thing working. Thanks.
Edit:
Thank you, everyone. The problem was solved. It appears there was a problem with my Scala plugin installation. A complete reinstall of everything (including Eclipse) helped. Also, this time I did not install the Groovy plugin.
I don't know which version of Eclipse / Scala-IDE you're using, but there are two reasons I know this sometimes happens:
1) You don't have JDT weaving for Scala installed.
The scala-ide uses aspects to weave in code into the JDT compiler. If you don't have this installed, this may cause the Scala files to be seen as Java files.
2) If, somehow, the Java Source File content type includes *.scala. In fact, it should be Scala Source File. If this is the case, you should remove the *.scala from the Java Source File content type.