IntelliJ 14 - Create / Import a Scala / SBT project - scala

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.

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 IDEA - Cannot add framework support for Scala

I have sbt 0.13.16 and Scala 2.10.6 running with Intellij 2018.2.1, working with those recommended sbt and Scala settings for Odersky's coursera course on Scala (I'm guessing their automated submission grader depended on old SBT?).
When creating new sbt + scala projects, I choose the above sbt and Scala versions, then after all the dependencies have downloaded, when I right-click New -> ... I see options for Java class but nothing for Scala. I have the Scala plugin already there according to the plugin settings.
So I try to Add Framework Support after right-clicking on the project, I select Scala, but then everything is disabled except Cancel.
I looked through previous forums, found one but that seemed relevant only for git projects.
Anyone else run into this issue? Do I need to update to more recent Scala and SBT? Any help would be very appreciated.
Please check https://plugins.jetbrains.com/plugin/1347-scala/versions for a compatibility table.
You can manage plugins in IntelliJ Preferences. Your versions seem to be too old to still be supported, already. It may help to upgrade IntelliJ and then go to preferences and get the latest Scala and SBT plugins.

IntelliJ IDEA w/ Scala Plugin not finding scala.concurrent

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.

Can NetBeans 8.0 with Scala and sbt plugins installed create sbt project?

I had previously used Scala-IDE, and I thought I'd give NetBeans IDE 8.0 a try.
I created Java/Maven projects successfully, but I don't seem to be able to create an sbt project. I have all the Scala plugins loaded as far as I can see, including the sbt plugin. Platform is Win 8.1 and Java 8.
Creating an NetBeans native project for Scala works, but there seems to be no option to create an sbt project. Is that expected?
Iff the plugin you use is nbscala-1.6.3.1 it appears from the documentation that the supported features are:
Recognize sbt project and open in NetBeans
Open sbt console in NetBeans (Right click on sbt project, choose "Open Sbt")
Jump to/Open compile error lines
I conclude that there's no support for creating a new sbt project using the plugin.
You'd have to create a sbt project using Typesafe Activator and only then use NetBeans with the plugin to open it and start hacking right in the environment.

IntelliJ IDEA 12 versus sbt 0.13

I am updating a couple of projects to sbt 0.13. I am using IntelliJ IDEA 12 (not interested in EAP 13 at this moment). I am using the sbt plugin by orfjackal. By default it uses an sbt-launch.jar bundled with IDEA. At least the settings claim that. That has version 0.12 and cannot be launched now because of some JLine incompatibility.
If I go to Settings -> Project Settings -> SBT -> IDE Settings, and specify the 0.13 launcher as custom jar, it works while IntelliJ is open. But the settings are lost when I quit and restart IntelliJ.
So my new idea is to try to replace the bundled sbt-launch.jar. If I open the app bundle (OS X) and search for that name, nothing shows up.
Where is the bundled sbt-launch.jar and how can I swap it?
I believe that SBT jar is located inside your configuration directory. Usually it is something like ~/.IntelliJIdea12, so simple search in this directory gave ~/.IntelliJIdea12/system/sbt/sbt-launch.jar. Try replacing it.
BTW, there is currently a new official SBT plugin being developed by JetBrains. It really is great and simplified SBT usage inside IDEA a lot (esp. dependency management), but it does not have embedded console yet (it will, soon). You can try it out even in 12.X IDEA.