I\'m trying to modify the build.sbt file to add scalatest dependencies in IntelliJ IDEA. There\'s no error log in the console but I got a Unknown artifact. Not resolv
This has been infuriating me for a couple of hours now, but I think I finally understand partly what's going on. None of the above suggestions worked for me.
From Automatic Dependency Management in the sbt docs:
sbt 1.3.0+ uses Coursier to implement dependency management. Until sbt 1.3.0, sbt has used Apache Ivy for ten years. Coursier does a good job of keeping the compatibility, but some of the feature might be specific to Apache Ivy. In those cases, you can use the following setting to switch back to Ivy:
ThisBuild / useCoursier := false
My interpretation of my situation is that IntelliJ doesn't have proper support for Coursier (which is strange), but sbt is using Coursier to download dependencies, then IntelliJ can't find them because it's looking in my ivy cache. facepalm
I'm using OSX, IntelliJ IDEA Ultimate 2019.2.3, Scala 2.12.8, JDK8 (because I'm working with Spark) and sbt 1.3.3.
Adding the above line to my build.sbt
file solved the problem for me. My ~/.ivy2/cache
directory is now up to date. Coursier stores its cache in ~/Library/Caches/Coursier/v1
(docs) but I can't seem to find a way to get IntelliJ to use the Coursier cache to resolve dependencies. Any more information on the subject from someone who knows more about sbt than me would be welcome!
I had the same problem. File -> Invalidate Caches/Restart... fixed the issue for me.
Just updating/refreshing project didn't work in my case.
If you just added the dependency, it might not have been downloaded yet. Refresh/reimport the project to do so.
If it has already been downloaded, press Alt+Enter in IntelliJ on the lines with the warning and select the "update project resolvers' indexes" quickfix, then select the "local cache" index and click "update".
You can verify that the update worked by checking the date in the "Updated" column:
In my situation, I tried:
None of the above worked. So for future reference, here is my solution for this issue:
This process may take some time to finish download if it's a newly installed IntelliJ IDEA.