Running 'gradle idea' from command line reverts back to old Scala facets in IntelliJ IDEA 14

When gradle is executed from command line outside of IDEA and when IDEA restarts all Scala modules earlier converted from facets to SDKs will be reverted back to facets.

See this post about recent changes in the Scala IDEA plugin: http://blog.jetbrains.com/scala/2014/10/30/scala-plugin-update-for-intellij-idea-14-rc-is-out/

“Another change is that we’ve finally decided to get rid of the Scala facet and replace it with so called Scala SDK library”

I’ve come up with a few tedious workarounds which all of them involves removing cached files.

Software versions: Gradle: 2.2 IntelliJ IDEA: 14.0.2 Scala plugin: 1.1.3 Platform: Win 8.1 Pro 64-bit, Mac OS X 10.10.1

This is a multi-project build with a mixture of java and scala projects.

The first time after running the cleanIdea task and with an empty out folder you are prompted with this:

Running it a seconds time after the conversion taking place you end up in this state:

I am facing similar issue with idea14