Scala – Getting IntelliJ IDEA understand SBT dependencies

intellij-ideasbtscala

I have SBT and Scala installed and things work well.

Now I have an IntellIJ IDEA project, which works otherwise OK except that dependencies which are downloaded into /Users/MyName/.ivy2/cache/ are not understood.

I tried setting the cache path as a source folder:

enter image description here

but still things don't work out:

enter image description here

As you can see, org.eclipse is in red color meaning it can't find it. It must be inside that .jar file I showed on the left.

I just want to update/download dependencies using SBT, and then get the compilation to work in IntelliJ IDEA with those dependencies.

Best Answer

Use the sbt-idea plugin for SBT. Then you can run "gen-idea" from the sbt command line and it will generate the metadata files used by IDEA. These files contain the locations of jars as SBT uses them so that IDEA will know where the dependencies are, just like SBT.

Related Topic