IntelliJ IDEA: Cannot import SBT project
Solution 1
After a series of struggles, I must say something weird solved this problem – moving to IntelliJ IDEA Ultimate. That has built in Play application support and can run/debug/test the application out of the box, which is very handy.
All I can say after this experience was that JetBrains wants you to upgrade to Ultimate if you want things to work right out of the box.
I'm sure there are ways to get this working with CE also, but I wasn't successful with that.
Solution 2
I had this error when importing a new module from existing sources.
- On the right-hand side of your IntelliJ window, you will see a list of vertical tabs, open the
SBT
tab. - Select the module that's causing trouble, right click on it, select "Detach external project"
- Try to import the module again.
Solution 3
- Move to
/your-project-folder
- Run
./activator
- Type
idea
. It will generate IDEA project. - Open (not import)
File->Open..
project in IDEA.
Solution 4
I had a similar problem which came from a different place than the other solutions here so adding it in case it occurs for others.
In my case the problem was caused by accidentally opening the IdeaProjects directory. When you do this, it creates the .Idea folder in that directory, and populates it as a project. This apparently also confuses the set import.
The solution is to remove the .Idea folder and open (not import) the directory again.
Solution 5
I encountered the same error when I was trying to import a new scala project A to an existing IntelliJ project B as a module. I solved the problem by following step below:
- Go to your folder of project B. Open file .idea/sbt.xml.
- Deleting the entry which includes the path of project A.
Comments
-
Ashesh about 3 years
I'm completely new to development using Play or IntelliJ for that matter. I've created a simple HelloWorld application using Activator, and this is an
sbt
project.I've been trying to import this to IntelliJ and this is the screen I'm stuck at: https://www.dropbox.com/s/we1a4a3184sojvb/Screenshot%202014-07-24%2016.57.11.png
In almost all tutorials I've been through online, I've seen people using an
sbt
option on the import screen. I've installed the SBT plugin as well, but that hasn't helped. I've restarted IntelliJ several times to no avail.Where am I going wrong? I'm running
13.1.4
with theSBT
plugin installed. -
Ashesh almost 10 yearsI've done that. And I'm currently on IntelliJ IDEA 13.1.4 but it just doesn't work. I've also installed all the plugins already. dropbox.com/s/zncnc2udwxe73rs/…
-
Ashesh almost 10 yearsI've done that but I'm afraid its still quite broken. I cannot resolve classes, for example,
WS.Response
cannot be resolved. Its really strange. Maybe switching from Typesafe Activator to just plain-jane Play will help. -
Ryoichiro Oka almost 10 yearsThen I think the reason is because the project that you're trying to import doesn't have a
build.sbt
file as @Cloudtech is saying. IntelliJ recognizes an SBT project when it finds out the build file inside of the project's folder, not by finding out.scala
files. So just make a new file in the project naming itbuild.sbt
, maybe writing some contents in it, then try again. Hope it works this time! I edited my answer including this tip. -
red1ynx almost 10 yearsTry
sbt idea with-sources=yes
-
Kevin over 8 yearsThis was a simple solution that worked perfectly. Thank you.
-
pjvds over 8 yearsPerfect, this was the solution for me.
-
Harsh Vardhan Ladha almost 7 yearsThe topmost answer in this thread said "Uninstall Everything". Thanks for keeping the faith in StackOverflow. Perfect answer.
-
Yordan Georgiev over 6 years"import the module again" = File - New - Project from Existing sources
-
OlliP almost 5 yearsI use IntelliJ Ultimate and I have the same problem (though not using sbt nor Scala, but Gradle and Java). So, no: The problem also exists for the ultimate edition.
-
Dr. Vick almost 4 yearsThis also solved my problem. I initially tried to use version 2020.1.2 - Ultimate. For some weird reason it didn't work. When moving back to the same version but the CE release, it stopped working. Removing the
.idea
folder solved my problem for good. -
invzbl3 almost 4 years+1 to @OlliP, I have reproduced the same issue using Spring Initialzr for basic Spring Boot project and when I open this project inside Intelij IDEA. After several attempts, I've succeeded with it and IDEA loaded all dependencies.