且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何为 IntelliJ IDEA 项目禁用或启用 Gradle/Maven 自动导入?

更新时间:2022-10-14 23:09:19

自动导入是

2020.2+ 版本中,可以在设置(macOS 上的首选项)中配置自动重新加载行为 |构建、执行、部署 |构建工具 |更改构建脚本后重新加载项目:

2020.1.2 版本开始,有一个三态选项用于导入更改,它可用于 Gradle 和 Maven:

2020.1.1 版本中,您可以启用或禁用外部更改的自动重新加载(2020.1 中不存在该选项):

另请参阅

I inadvertently clicked the link to enable auto import of a Gradle project I was working on. How do I disable it for the current project? The only option I'm finding is for disabling it by default for all projects.

I'm on IDEA 2017.1.

Auto import is disabled by default while editing (and enabled for external changes) and an icon is displayed in the top right of the build file editor after you make changes to the build file so that you can load the changes and perform the import:

In 2020.2+ versions automatic reload behavior can be configured at Settings (Preferences on macOS) | Build, Execution, Deployment | Build Tools | Reload project after changes in the build scripts:

Starting with 2020.1.2 version there is a 3-state option for importing changes, it's available for both Gradle and Maven:

In 2020.1.1 version you can enable or disable the automatic reload of the external changes (option not present in 2020.1):

See also the related feature request to make the UI more obvious as it may be hard to notice a small icon suggesting to import the settings.


Before 2020.1 version you could disable it in Settings | Build, Execution, Deployment | Build Tools | Gradle | Use auto-import: