126

I'm using IntelliJ IDEA 13 (Community Edition) with the Scala plugin.

My initial import of an existing Scala project with a build.sbt worked fine. The library dependencies were picked up by IDEA. Additional dependencies added after the initial import were not picked up, although I had checked the auto-import option.

How can I force IDEA to reload the dependencies from build.sbt?

David B.
  • 5,090
  • 5
  • 28
  • 51
  • 1
    I had the exact same behaviour you're describing, and then it started working without me doing anything. I'm under the impression that sbt integration is a bit of a mess right now and we just need to be patient. – Nicolas Rinaudo Dec 06 '13 at 08:21
  • Still not working for me (Jan 2017). – qu1j0t3 Jan 20 '17 at 15:37

6 Answers6

202

You can force SBT to reload changes: Open SBT toolwindow (on the right side of IDE) and press refresh button.

If you use auto-import feature you need to save your file to force auto-refresh.

Alefas
  • 2,956
  • 1
  • 14
  • 7
  • 17
    Here's how to open SBT tool window: http://stackoverflow.com/questions/32374193/how-to-open-sbt-tool-window-in-intellij (in case anyone else is unavailable to find it) – Kaushik Acharya Nov 16 '16 at 10:46
15

IF plugin gets 'stuck' it helps to invalidate cache (under file menu) and restart intellij.

mary jane
  • 511
  • 6
  • 18
4

As of 7 Dec, 2013, the issue is solved. You need to update the Scala plugin in IntelliJ IDEA (this applies to both community and ultimate editions).

This is the link to the issue opened on JetBrains developer community web site: http://devnet.jetbrains.com/thread/451395

David Riccitelli
  • 6,847
  • 4
  • 37
  • 54
  • This seems unrelated to the original question. The jetbrains bug says "When creating a new project, from an existing SBT project". The issue is that IntellliJ sometimes won't get the latest libraries, even with auto-import enabled. As @alefas points out, sometimes you have to force reload (ebven with a Scala plugin from 2018). – danio Jun 28 '19 at 08:45
3

This may be due to a broken publication of org.jetbrains:sbt-structure:latest.integration that occurred tonight, about 4 or 5 hours ago. Given that your post is 4 hours old ...

You can see the ivy activity in idea.log (~/Library/Logs/IntelliJIdea13 or ~/Library/Logs/IdeaIC13 on OSX).

[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: org.jetbrains#sbt-structure;latest.integration: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn]  Note: Some unresolved dependencies have extra attributes.  Check that these dependencies exist with the requested attributes.
[warn]          org.jetbrains:sbt-structure:latest.integration (sbtVersion=0.13, scalaVersion=2.10)

I have opened a ticket at JetBrains.

Jacek Laskowski
  • 64,943
  • 20
  • 207
  • 364
Jeffrey Aguilera
  • 1,246
  • 11
  • 8
  • 2
    It looks like it was a problem with Ivy latest.integration, after sbt repository was moved to another mirror. Now in Scala plugin 0.26.323 it resolves to exact sbt-structure plugin version (1.0.2), and everything should work. Best regards, Alexander Podkhalyuzin. – Alefas Dec 06 '13 at 13:38
  • @Jeffrey, could you link to the support ticket? The latest update now properly adds new additional dependencies, but doesn't pickup changes to the version of an existing dependency (I have to manually change the various *.iml and .idea/libraries/SBT_SBT_*.xml to the new version number). I'd like to follow up on that ticket. – David B. Dec 07 '13 at 03:50
  • 1
    My ticket was a duplicate of [SCL-6340](http://youtrack.jetbrains.com/issue/SCL-6340) – Jeffrey Aguilera Dec 14 '13 at 03:42
0

Ticket for broken plublication of sbt.jetbrains is resolved. Updating scala plugin will fix this issue Ticket : http://devnet.jetbrains.com/thread/451395

Rajeev
  • 4,222
  • 7
  • 33
  • 52
0

Perhaps this working only for some kind of projects, but in my case,

on the Library side, I do in sbt: publishLocal

on the Client side where the Library goes into, I click the menu item Build -> Build (Ctrl-F9), and sometimes, when open Files or Intellisens are not yet current, I do Ctrl-Alt-Y (Menu item File -> Synchronize) to get the file reflecting the refreshed code base.

Not having to refresh all sbt projects is faster for me.

Hartmut Pfarr
  • 3,994
  • 4
  • 32
  • 38