Danijel
Danijel

Reputation: 8616

What's the difference between `Eclipse/Project/Clean...` and `Eclipse/Project/Refresh (F5)`?

What's the difference between

"Eclipse/Project/Clean..."

and

"Eclipse/Project/Refresh (F5)"

I often have to "rebuild" my workspace that contains few inter-dependent projects, and I am unsure which is the best way to make a clean start?

Upvotes: 12

Views: 4203

Answers (4)

phayes
phayes

Reputation: 3

In Eclipse 4.31.0 - Eclipse IDE for Enterprise Java and Web Developers (includes Incubating components) Version: 2024-03 (4.31.0) Build id: 20240307-1437 For Windows 11, in 2024:

"Eclipse/Project/Clean..."

is an option that will delete the artifacts that were produced by the latest build. See this answer for additional details regarding interpretation of clean in Eclipse 2024.

"Eclipse/Project/Refresh (F5)" 

Is an option which now exists in the Project Explorer context menu and no longer exists via the Project menu (though F5 does exist as the bound key for a refresh in the default keymapping, and exists in the Project Manager right-click menu). This will load any pending (previously not present) changes in the currently selected file(s) in the Project Explorer. To scan changes for the entire workspace, select all files in the Project Explorer.

Upvotes: 0

Pradeep Pati
Pradeep Pati

Reputation: 5919

Clean will clean all the compiled files from the selected projects. It will trigger a rebuild if Build Automatically (in the project menu) is enabled.

Refresh will reload the files in the project from the filesystem.

For your question, Clean will be the answer. Make sure that you have Build Automatically checked.

Upvotes: 1

dsgriffin
dsgriffin

Reputation: 68586

As mentioned here

Refresh analyses the source-files to check if any changes were made from outside Eclipse, and if so, compiles files that were changed.

Clean on the other hand removes all compiled classes and forces recompilation of the whole project (or workspace).

Upvotes: 15

Bharat Sinha
Bharat Sinha

Reputation: 14363

Clean deleted the generated resources like compiled classes and makes sure that latest code base is recompiled again where as

Refresh syncs the eclipse project from the actual folder structure which makes sure that any changes done to files and/or folder structure is available to eclipse...

Upvotes: 3

Related Questions