Corram
Corram

Reputation: 305

How do I resolve "Cannot add dependency [...] to configuration 'default' of module [...] because this configuration doesn't exist"?

The problem arises after adding ThisBuild / useCoursier := false to my build.sbt file. Plugins.sbt file is

addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.15.0")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.2") // "2.4.0" is just sbt plugin version

When loading SBT changes in IntelliJ, I then get

[error] stack trace is suppressed; run 'last updateSbtClassifiers' for the full output
[error] (updateSbtClassifiers) java.lang.IllegalArgumentException: Cannot add dependency 'org.scoverage#sbt-scoverage;1.6.1' to configuration 'default' of module de.corram#my-etl$sbt_2.12;0.1.1 because this configuration doesn't exist!
[error] Total time: 16 s, completed 17 Mar 2021, 16:47:44

Upvotes: 3

Views: 1584

Answers (2)

MSmedberg
MSmedberg

Reputation: 481

This issue seems to crop up from time to time. There's a comment in the linked GitHub issue that pointed me towards a workaround: I had recently enabled "Download SBT sources" in my IntelliJ settings, and it appears that that setting doesn't play well with some plugins. Unchecking that setting (Settings -> Build, Execution, Deployment -> Build Tools -> sbt) fixed IntelliJ for me.

Upvotes: 3

Tiago Simões
Tiago Simões

Reputation: 433

I solved a similar problem by deleting .bsp and .idea directories from the project file. And import the project again on IntelliJ.

Upvotes: 1

Related Questions