Reputation: 195
Is there any difference if I perform clean + Build Vs only Build in Eclipse?
I am aware that clean will remove all compiled classes.
But if I only build it will just overwrite them isn't it?
So what is the advantage of performing clean + Build Over only performing Build.
Upvotes: 2
Views: 1340
Reputation: 140427
The whole idea of the incremental eclipse build is to give you better performance - whilst still ensuring integrity.
When you update your files (via your source code management tool) and files get erased, eclipse will detect that too - and automatically remove the corresponding artifacts, too! eclipse is really smart about dependencies and it will do its best to get things right without throwing away everything. Of course - the one precondition here: you have to refresh eclipse so that it checks file system contents to actually figure when things have changed! And of course, you want to have built automatically enabled!
You should see clean build as your last resort. Normally you only need it when eclipse is somehow "messed" up internally.
More of anecdotal evidence: our eclipse projects are large (a full clean build takes two minutes, and ends up with 100 000+ warnings). This means that each git fetch/rebase can result in a lot of files added/changed/deleted. Still I do not need to run a clean build - I do not even recall the last time a clean build was required. And still everything works nicely, and no pillage of garbage in my output directories!
The one exception in my eyes: when you are using SVN repositories and SVN plugins for eclipse - then the need for "clean builds" might be noticeably higher. As all SVN plugins for eclipsee do not work perfect for large code bases. They do all kinds of internal caching - and I have seen many incidents when a clean build and eclipse restart was necessary to really get back to a working environment. ( for the record: the answer to such issues is to get rid of SVN within eclipse, for example by using the git-svn tooling )
Upvotes: 2
Reputation: 73548
Build without clean attempts to build only resources that have changed or need to be rebuilt for some other reasons.
Sometimes you still need to do a clean in order to get a clean slate and not have obsolete resources end up breaking your build or software.
For example if you delete a class, and do a build without clean, the previously compiled class file would still exist and potentially cause problems.
Upvotes: 4