Eclipse 会自动保存

我希望 Eclipse 在每次编辑文件时自动保存,就像它自动构建文件一样。因为我去年一直在使用 IntelliJ (默认情况下它会自动保存) ,所以我一直有以下问题:

  • 在 Eclipse 中进行一些更改
  • 忘了按下保存键
  • 运行构建、单元测试,并注意一些奇怪的行为
  • (一段时间后... ...)意识到意外的行为发生是因为我忘记保存更改

有没有什么方法可以让 Eclipse 自动保存?

57351 次浏览

You can do it with the saveDirtyEditor plugin as referenced in this question/answer. There is no non-plugin way of doing it.

You can go here and check the box Save automatically before build

Windows > Preferences > General -> Workspace

I wrote an Eclipse plugin for this called smartsave. It's available in the Eclipse Market Place.

It saves your files at a specified interval and you can even tune it to prevent saving if errors, or warnings, are present in the preferences dialog.

In Helios this can be done by going to preferences and setting:

Run/Debug > Launching > Save required dirty editors before launching

First, try Window -> Preferences -> General -> Workspace. There you can check "Save automatically before build" and "Build automatically."

If that does not work,

PLEASE TRY

Preferences -> Run/Debug -> Launching -> "Save dirty editors before launching"

Eclipse Neon (4.6)

Window > Preferences

Window Preferences

General > Editors > Autosave > check Enable autosave for dirty editors > choose the value for autosave interval (in seconds)

General Editors Autosave

Details in M7:

Auto-save of dirty editors is now available in Eclipse. The autosave option is disabled by default. A new autosave preference page (Preferences > General > Editors > Autosave) is available and allows to enable/disable the autosave and change the interval of autosave. The countdown is reset on keyboard activity, mouse click, or when a popup is displayed (e.g. content assist, preference page, ...).

For Eclipse Mars 2, the settings are below Window > Preferences > General > Workspace. These settings are in minutes and not in seconds.

enter image description here

You could go to Windows > Preferences > Autosave and set the auto intervals to 1.