关闭自动保存
首先,声明一点,intellij 默认是不自动编译的 ,这一点跟Eclipse不同。
- 1
- 2
另外,我们会发现intellij默认会自动保存,并且修改了文件也没有星号标注。
去掉默认保存,
File—>settings—->System Settings—>去掉勾选synchronize files on frame or editor tab activation和去掉勾选save files on frame deactivation
以上步骤,在网上比比皆是,但是解释这两个选项意思的却很少,这里解释一下,通俗的来讲
- 1
- 2
- 3
- 4
这里参考官方解释
注意,并不是说,做了以下两点就关闭了自动保存。还有其它条件能触发保存,比如编译、关闭intellij、启动中间件服务器(tomcat、jetty)等,官方参考
When does IntelliJ IDEA auto save changed files?
Autosave is initiated by:
- Compiling a project, a module or a class
- Starting a run/debug configuration-
- Performing a version control operation such as pull, commit, push, etc.-
- Closing a file in the editor
- Closing a project
- Quitting the IDE
In fact, there is a lot more autosave triggers, and only the most important ones are mentioned above.
标志修改文件为星号
File—->Settings—–>Editor—->General—->Editor tabs—->勾选 mark modified files as asterisk
保存全部
配置了以上两步后,在使用保存全部(ctrl+s)命令,就手动保存文件了。