IDEA integration with Scala plugin broken since Gradle 3.0 (No such property: daemonServer)


Gradle Version: 3.0
Operating System: OSX El Capitan (10.11.6)
This worked fine in 2.4
IntelliJ IDEA 2016.2.2
Build #IU-162.1628.40, built on August 16, 2016
JRE: 1.8.0_76-release-b216 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o

A simple build file like this:

apply plugin: 'scala'
dependencies {
    compile ('org.scala-lang:scala-library:2.10.4')

Will result in a warning in the idea messages tab “Gradle sync”

Unable to build Scala project configuration
Details: groovy.lang.MissingPropertyException: No such property: daemonServer for class: org.gradle.api.tasks.scala.ScalaCompileOptions
Which renders my module broken (no scala compiler configured and can't build the sources)

As mentioned in the release notes
The property `daemonServer` has been removed since the migration from the Ant-based compiler to the Zinc Scala Compiler, which most probably is the cause of this issue.

As this is more of a problem over at IDEA I made sure there was an issue filed, but I still think it is worth mentioning over here as there might be a way to make the current plugin backwards compatible and we might get a working idea/gradle scala plugin before they keep up over at JetBrains.

Hi Ted,

thanks for reporting this! We already had another report: Scala 2.12.0.M5 , MissingPropertyException : daemonServer

I just didn’t get that this error happens when importing the project into IDEA. Thanks for opening the bug in the IDEA youtrack. I will mark this forum entry as not-a-bug since it is not a bug in Gradle itself.

You can work around the error by doing a little bit of monkey patching in your build.gradle:

ScalaCompileOptions.metaClass.daemonServer = true
ScalaCompileOptions.metaClass.fork = true
ScalaCompileOptions.metaClass.useAnt = false
ScalaCompileOptions.metaClass.useCompileDaemon = false

I do not know if this is a good idea and what Intellij IDEA would do with this information but at least it makes the error go away :wink:



Very nice, thanks for your swift response!

I can’t believe I missed that post, I was googling like crazy and probably lost it somewhere in all the tabs.
Luckily my new post added some value tho :slight_smile:

I did the monkey patching and it did not only make the error go away, it actually fixed it so now my scala projects compile just like before.