Issue while creating sbt project in IntelliJ


#1

I am trying to create a sbt project in IntelliJ. Project does get created with build.sbt as:
name := “scalalearning”

version := “0.1”

scalaVersion := “2.12.4”

But IntelliJ says ‘Cannot resolve symbol’ for all these 3 entries.

Also. console shows messages as:
/////////////////////////////////////////////////////////////////////
SBT ‘scalalearning’ project refresh failed

Error:Error while importing SBT project:

[error] 	at sbt.io.Using.apply(Using.scala:22)
[error] at sbt.MainLoop$.runWithNewLog(MainLoop.scala:101)
[error] at sbt.MainLoop$.runAndClearLast(MainLoop.scala:57)
[error] at sbt.MainLoop$.runLoggedLoop(MainLoop.scala:42)
[error] at sbt.MainLoop$.runLogged(MainLoop.scala:34)
[error] at sbt.StandardMain$.runManaged(Main.scala:113)
[error] at sbt.xMain.run(Main.scala:76)
[error] at xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:109)
[error] at xsbt.boot.Launch$.withContextLoader(Launch.scala:128)
[error] at xsbt.boot.Launch$.run(Launch.scala:109)
[error] at xsbt.boot.Launch$$anonfun$apply$1.apply(Launch.scala:35)
[error] at xsbt.boot.Launch$.launch(Launch.scala:117)
[error] at xsbt.boot.Launch$.apply(Launch.scala:18)
[error] at xsbt.boot.Boot$.runImpl(Boot.scala:41)
[error] at xsbt.boot.Boot$.main(Boot.scala:17)
[error] at xsbt.boot.Boot.main(Boot.scala)
[error] java.lang.ClassNotFoundException: org.jetbrains.sbt.CreateTasks$
[error] Use ‘last’ for the full log.
[info] shutting down server
//////////////////////////////////////////////////////

Infact, my earlier sbt projects too have stopped working. Sbt dependencies no more work it seems.
Any idea why IntelliJ behaves like this so frequently?


#2

Hello,

What happens when you run SBT from the terminal?

Did you try to reinstall the IntelliJ Scala plugin?

Best, Oliver


#3

I find it is best to quit IntelliJ, remove your .idea folder from the
project directory and re-import the SBT project. You won’t lose too much
most likely, just breakpoints, run configs, stuff like that, but at least
you’ll be working again.


#4

sbt compile fails with unresolved dependencies.


#5

Thats the only option I am left with. But IntelliJ keeps on doing things like this. It seems IntelliJ support for sbt has issues.


#6

Maybe you first need to fix the dependency resolution?


#7

Same dependencies used to work before.


#8

What’s the error message if you run SBT in a terminal?

Have you tried something like “sbt clean”?


#9

I solved the issue by deleting .idea folder and reimporting the project.
But it keeps returning back. Would look into ‘sbt clean’.