IntelliJ 2017.2 does not update snapshots (Scala SBT)

Dear Community,

I have been using IntelliJ Ultimate for Scala development with SBT 1.0.0. I'm also using Coursier for SBT, an SBT plugin which adaptively re-fetches snapshots when they change on the repository server. Using SBT in command line, creating assembly and packages is convenient and accurate in terms of changing snapshot versions. Coursier immediately identifies snapshots, updates them and re-compiles the source on-the-fly. However, I can not make IntelliJ to update and reindex these snapshot dependencies. SBT refresh button does not work for this matter. When I clear Coursier cache, IntelliJ re-indexes and updates project dependencies, then binary JARs are re-fetched correctly, but somehow, source JARs are not.

Please provide me useful tips on how to force dependency updates in IntelliJ in a convenient way, running Scala programs are incredibly hard in this sense (when snapshot updates are frequent).




Hi Zoltán,

can you give me an example of the workflow that causes coursier to fetch updates when using sbt, but not IntelliJ?

Have you activated the "download sources" option in the sbt preferences?

Also, have you tried "use sbt shell for build and import" option?


Hi Justin,

I am using SBT shell for build and import, in addition to this, "download sources" is enabled.

The workflow is the following. Let's say I have a dependency A that contains a class C. I run `sbt ~test:compile` through the SBT shell from IntelliJ. Coursier checks snapshot dependencies by a pre-configured TTL value. Let's say if TTL passed, and Coursier updates dependencies. If I check the contents of A.jar from `user.home/.couriser/cache/...`, I see C updated. The `sbt ~test:compile` completes and without errors, and the project source code already depends on the change introduced to C. Now I press CTRL+SHIFT+N in IntelliJ and search for C. I find C.class and C.scala. Neither is updated with the change. If I delete dependency A from project dependencies (under project settings, modules, dependencies), and do an SBT refresh in IntelliJ, C.class updates, but C.scala does not. This renders debugging useless, due to Scala simulating everything with classes of `C$anon$23$anon$5` for example. I think sources are downloaded by IntelliJ automatically and not by Coursier. However, when I ask IntelliJ to download sources for A, it does not find it. Probably it is looking only in public Maven repositories, but with Coursier, I'm using 5 additional repositories - these repositories are defined in the regular way, within `build.sbt`. Switching off Coursier does not improve on anything, but dependency checks and fetches become much slower.



In the meantime, I have realized, that source JARs are located at `{user.come}\.IntelliJIdea2017.2\system\jars`. I have to close IntelliJ manually, delete the source JARs in question, and force an SBT import. Very inconvenient. SBT detects that binary and source JARs have changed on the remote repository, so local ivy2/coursier cache is updated. However, IntelliJ does not update the source files.


IntelliJ should be using the sources that are downloaded via Coursier or ivy when they are provided. From your description, however, it sounds like the caches IntelliJ uses aren't updated when new versions of snapshots are available. Can you try the menu option "File / Invalidate caches" and see if that helps? (Still inconvenient, but it should point us in the right direction)


I have tried that one as well, but `{user.come}\.IntelliJIdea2017.2\system\jars` does not get deleted. These JARs are invalidated somehow, and reloaded, but rarely and it is not clear to me, when.

IntelliJ does not use sources downloaded via Coursier or ivy unfortunately, or at least these sources are copied to `{user.come}\.IntelliJIdea2017.2\system\jars` and never updated.


That sounds strange. Can you check what sources are supposed to be used in the Project Structure menu for any of the dependencies in question: