Strange sbt error where I cannot import the sbt project due to the keys colliding

After changing my build.sbt file in IntelliJ, I get this strange error report where it seems that the β€œkeys” (I don’t know that these keys even exist) collide with themselves. Examining this error message only finds requests on github pull, where people request library support to prefix their keys to avoid collisions. How do these IntelliJ built-in keys come across? That doesn't make any sense. Here is an excerpt from the stack trace:

 java.lang.RuntimeException: Some keys were defined with the same name but different types: 'ssExtractBuild' (sbt.Task[org.jetbrains.sbt.structure.BuildData], sbt.Task[org.jetbrains.sbt.structure.BuildData]), 'settingData' (sbt.Task[scala.collection.Seq[org.jetbrains.sbt.structure.SettingData]], sbt.Task[scala.collection.Seq[org.jetbrains.sbt.structure.SettingData]]), 'taskData' (sbt.Task[scala.collection.Seq[org.jetbrains.sbt.structure.TaskData]], sbt.Task[scala.collection.Seq[org.jetbrains.sbt.structure.TaskData]]), 'extractStructure' (sbt.Task[org.jetbrains.sbt.structure.StructureData], sbt.Task[org.jetbrains.sbt.structure.StructureData]), 'ssExtractDependencies' (sbt.Task[org.jetbrains.sbt.structure.DependencyData], sbt.Task[org.jetbrains.sbt.structure.DependencyData]), 'ssExtractProjects' (sbt.Task[scala.collection.Seq[org.jetbrains.sbt.structure.ProjectData]], sbt.Task[scala.collection.Seq[org.jetbrains.sbt.structure.ProjectData]]), 'ssExtractAndroid' (sbt.Task[scala.Option[org.jetbrains.sbt.structure.AndroidData]], sbt.Task[scala.Option[org.jetbrains.sbt.structure.AndroidData]]), 'ssExtractRepository' (sbt.Task[scala.Option[org.jetbrains.sbt.structure.RepositoryData]], sbt.Task[scala.Option[org.jetbrains.sbt.structure.RepositoryData]]), 'ssOptions' (org.jetbrains.sbt.Options, org.jetbrains.sbt.Options), 'commandData' (sbt.Task[scala.collection.Seq[org.jetbrains.sbt.structure.CommandData]], sbt.Task[scala.collection.Seq[org.jetbrains.sbt.structure.CommandData]]), 'ssExtractProject' (sbt.Task[scala.collection.Seq[org.jetbrains.sbt.structure.ProjectData]], sbt.Task[scala.collection.Seq[org.jetbrains.sbt.structure.ProjectData]]), 'ssExtractPlay2' (sbt.Task[scala.Option[org.jetbrains.sbt.structure.Play2Data]], sbt.Task[scala.Option[org.jetbrains.sbt.structure.Play2Data]]) 

And the full stack trace is here: https://pastebin.com/ymZvgMCj

This happened after I added a dependency on my build.sbt . At first I thought it was a problem, and tried to remove it, but now my build.sbt does not even work in the previous state! I cleared my intellij cache, restarted, completely deleted the .idea folder in this project and renamed the whole project to intellij, and I still have the same problem. What could happen the last time I changed my build.sbt and now it would break this project?

+31
java scala intellij-idea sbt
source share
7 answers

I also had the same problem, I β€œfixed” it by installing and reinstalling IntelliJ.

Intellij Version: IntelliJ IDEA 2017.2.5 Build # IU-172.4343.14 Scala Plugin version: 2017.2.13

Steps that don't work

  • Switch git branch
  • Invalid Caches / Reboot
  • Removing the .idea and reimport directory
  • SBT configuration change in order not to use the combined jar
+3
source share

Go to

 Preference -> Build, Execution, Deployment -> SBT -> check "Use SBT shell for build and import" -> Press OK 

Now you can upgrade your SBT projects and this should work. if you want, you can uncheck "Use SBT wrapper for assembly and import" and this will also work

+75
source share

I had the same error with the latest version of Idea 2017.3 EAP. I could not import the project and got the same error. The fix for me was to switch to another branch, import the project (which was successful), then go back to the original branch and reimport the project to Idea (click the sbt update button).

There were no problems running sbt in the terminal, only in Idea. Sounds like a problem to an idea ...

+2
source share

I also had this problem when I developed Spark using Intellij Idea and I will fix this by changing "File -> Settings -> Build Tools -> sbt -> Group modules" to "using qualified names"

and select "File -> Settings -> Assembly Tools -> sbt -> Use the sbt Shell for Build and Import".

+1
source share

In my case, I had a Python module. Renamed externally, and intellij cannot do anything with the structure of modules. Including sbt refresh.

Using sbt shell did not solve the problem. Revoking the cache and restarting also did not help.

I have to remove sbt.xml in the project folder /.idea .

This will erase your current SBT settings. Not a bid, since sbt did not work at all.

+1
source share

I experienced it today, tried these things that DO NOT fix it:

  • Use SBT shell to build and import (SBT settings)
  • Invalidate the cache and restart

However, the problem finally disappeared when I did this:

  • Increase the maximum SBT heap size to 6000 (this was 5000)
0
source share

I had the same problem today. My solution was:

  • invalidate cache
  • close intellect
  • remove .idea
  • import project
0
source share

All Articles