How to disable Gradle daemon in IntelliJ Idea?

18,663

Solution 1

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

Solution 2

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.

Solution 3

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.

Share:
18,663

Related videos on Youtube

Anatoliy Kmetyuk
Author by

Anatoliy Kmetyuk

Updated on September 09, 2021

Comments

  • Anatoliy Kmetyuk
    Anatoliy Kmetyuk over 2 years

    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?

  • Anatoliy Kmetyuk
    Anatoliy Kmetyuk over 9 years
    "gradle idea" is needed only to generate the required files. Though the recent versions of Idea use "directory-based" project structure, so the file generation is no longer necessary. With or without file generation, from inside the Idea the project is run the same way. It is a pity that we don't have enough flexibility here.
  • Peter Niederwieser
    Peter Niederwieser over 9 years
    gradle idea is still useful with the most recent IntelliJ versions (I use it all the time). "Not to use the IntelliJ Gradle integration" means not to use run configurations of type "Gradle", hence the project isn't run in the same way. Anyway, turning off the Gradle daemon is the wrong solution. Instead, try tasks.withType(ScalaCompile) { scalaCompileOptions.fork = true } or tasks.withType(ScalaCompile) { scalaCompileOptions.useAnt = false }, which will run Scala compilation in a separate process.
  • ch271828n
    ch271828n about 4 years
    same issue here!