scala 如何在 IntelliJ Idea 中禁用 Gradle 守护进程?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25422163/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to disable Gradle daemon in IntelliJ Idea?
提问by Anatoliy Kmetyuk
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:
我需要在 IntelliJ Idea 中禁用 Gradle 守护程序,因为不知何故 Scala 插件无法与守护程序一起使用(编译失败,并显示NullPointerException)。我试图编辑我的 IntelliJ Gradle 构建配置以包含一个 JVM 系统参数-Dorg.gradle.daemon=false:


Also I've tried to use --no-daemonflag at the same place (Script parameters and VM options). Also I've tried to specify these options in the Preferences -> Gradlemenu of IntelliJ. None of these attempts gave any result, the daemon continue to start, so I have to kill it before running/compilingfor the second time.
我也尝试--no-daemon在同一个地方使用标志(脚本参数和 VM 选项)。我也尝试在Preferences -> GradleIntelliJ的菜单中指定这些选项。这些尝试都没有给出任何结果,守护进程继续启动,所以我必须running/compiling在第二次之前杀死它。


Neither disabling daemon explicit in ~/.gradle/gradle.propertiesaccording to https://docs.gradle.org/current/userguide/gradle_daemon.html#N10473doesn't have any effect.
~/.gradle/gradle.properties根据https://docs.gradle.org/current/userguide/gradle_daemon.html#N10473明确禁用守护进程都没有任何效果。
How can I disable the Gradle daemon usage in IntelliJ Idea?
如何在 IntelliJ Idea 中禁用 Gradle 守护进程?
采纳答案by Peter Niederwieser
IntelliJ interacts with Gradle via the Gradle tooling API, which always uses the daemon. i.e. There is no way to turn it off.
IntelliJ 通过 Gradle 工具 API 与 Gradle 交互,该 API 始终使用守护程序。 即没有办法关闭它。
What you could do (after filing a bug report) is not to use the IntelliJ Gradle integration but instead generate IntelliJ project files with
您可以做的(在提交错误报告后)不是使用 IntelliJ Gradle 集成,而是使用以下命令生成 IntelliJ 项目文件
gradle idea
gradle idea
回答by Jochen Gebsattel
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.
由于缺乏对旧库的支持,我将一个项目从 gradle 转移到了 maven 构建管理工具。但是 Intellij 总是希望我触发 gradle 更改导入:除了“Maven 项目需要更新”之外,当我对 ie 中的依赖项进行更改时,还有一个“Gradle 项目需要更新” pom.xml,而没有集成 gradle项目源文件,没有包装器等。
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.xmland deleting the file .idea/gradle.xmlin Intellij IDEA Ultimate 2019.2.
在我的情况,我能够通过删除线摆脱困扰的IntelliJ用我的gradle
<property name="settings.editor.selected.configurable" value="reference.settingsdialog.project.gradle" />中.idea/workspace.xml,并删除该文件.idea/gradle.xml中的IntelliJ IDEA终极2019.2。

