I am using sbt console in my terminal to compile my scala/play project.
I am using intellij to edit my source code, basically using it just for getting some code completion and navigation etc.
For some reason certain libraries don't seem to load correctly. For example, I added elastic search to my Dependancies.scala file, reloaded sbt and everything compiles fine but for some reason IntelliJ doesn't pickup the jars correctly i.e. they are in red and there is no syntax completion.
How can I fix this? I tried shutting intellij down and restarting it but the problem remains.
I am using Intelli 13.1.3 (ultimate)
If you use IDEA 13.x with the Scala plugin, you can directly import your SBT file (File -> Import Project...), and you don't need the sbt-idea plugin. If during the Import you select "Use auto-import", it will automatically sync any changes to your build.sbt file.
At one time I had the problem of IDEA getting confused and not autocompleting / labelling dependencies as errors. In that case, using File -> Invalidate Caches / Restart... fixed the problem. That hasn't happened to me in recent versions, though.
When adding dependencies in general is good practice to regenerate idea xml configuration files (inside .idea and/or .idea_modules and the correlated .iml files), try adding this plugin and then use sbt gen-idea
, or even better if you're using play you can simply use sbt idea with-sources=yes
which ships with play as shown here.
Idea utilizes xml to store configurations, in fact if you look at them right now probably you won't find the jars/library you just added, simply because they are not automatically updated.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With