mpeltonen / sbt-idea

A simple-build-tool (sbt) plugin/processor for creating IntelliJ IDEA project files
Other
1.07k stars 153 forks source link

gen-idea can't always fix imports when changing libraries #301

Open ShardPhoenix opened 10 years ago

ShardPhoenix commented 10 years ago

I'm using sbt-idea 1.6.0. When adding new libaries or changing library versions, sometimes I'll naturally get "cannot find import" errors in IDEA even when it works on the command line. Usually, running gen-idea in sbt will fix this. However, sometimes this won't work no matter how many times I run gen-idea (or restart IDEA) - I'll keep getting the not-found errors in IDEA. I can only fix it by deleting the project's .iml file and running gen-idea again. May be related to switching between different versions of the same library, but I'm not 100% on that.

SheliakLyr commented 10 years ago

I may have encountered the same bug. Whenever I change libraries, after gen-idea idea project becomes corrupted (some libraries are not visible / duplicated and imports are not resolved).

I found a workaround that does not require you to remove imls. Try this:

Works every time. Of course it is still very irritating... My only guess so far is that idea and gen-idea write to imls at the same time, which results in corrupted files.

OlegYch commented 10 years ago

could it be this http://youtrack.jetbrains.com/issue/IDEA-121781 ?