How to disable Gradle daemon in IntelliJ Idea?

22k Views Asked by At

I need to disable the Gradle daemon in IntelliJ Idea, because somehow Scala plugin is not working with the daemon (the compilation fails with NullPointerException). I have tried to edit my IntelliJ Gradle build configurations to include a JVM system parameter -Dorg.gradle.daemon=false:

enter image description here

Also I've tried to use --no-daemon flag at the same place (Script parameters and VM options). Also I've tried to specify these options in the Preferences -> Gradle menu of IntelliJ. None of these attempts gave any result, the daemon continue to start, so I have to kill it before running/compiling for the second time.

enter image description here

Neither disabling daemon explicit in ~/.gradle/gradle.properties according to https://docs.gradle.org/current/userguide/gradle_daemon.html#N10473 doesn't have any effect.

How can I disable the Gradle daemon usage in IntelliJ Idea?

4

There are 4 best solutions below

2
On BEST ANSWER

IntelliJ interacts with Gradle via the Gradle tooling API, which always uses the daemon. i.e. There is no way to turn it off.

What you could do (after filing a bug report) is not to use the IntelliJ Gradle integration but instead generate IntelliJ project files with

gradle idea

2
On

I had a related problem and managed to disable the daemon through a config - I added org.gradle.daemon=false to a gradle.properties file in the project root folder. As explained here: Disabling Gradle daemon in a specific project.

1
On

To disable the daemon for a single command (or a single IntelliJ run configuration), you can also pass org.gradle.daemon=false as a VM Option:

-Dorg.gradle.daemon=false
1
On

Because of lack of support of old libraries I moved a project from gradle to maven build management tool. But Intellij always wanted me to trigger a gradle changes import: additionally to "Maven project needs to be updated", there was also a "Gradle project needs to be updated" when I did changes to i.e. dependencies in pom.xml, with no integration of gradle in the project source files at all, no wrapper etc.

In my case I was able to get rid of Intellij bothering me with gradle by deleting the line <property name="settings.editor.selected.configurable" value="reference.settingsdialog.project.gradle" /> in .idea/workspace.xml and deleting the file .idea/gradle.xml in Intellij IDEA Ultimate 2019.2.