11.8. Avoiding Output Folder Scrubs
Problem
Now that you’re working
with the files in a web
server’s directories, you want to change
Eclipse’s default behavior of
scrubbing—
that is, deleting—all the
files in a build directory because doing so deletes needed files in
those directories.
Solution
To stop Eclipse from scrubbing the output directory for a project every time you build the project, select Project→ Properties→ Java Compiler→ Use Project Settings→ Build Path, and uncheck the “Scrub output folders on full build” checkbox.
Discussion
When you start working with the files in a web container’s directories and not just your local Eclipse workspace, it can become a problem when Eclipse deletes all files in the output directory when you do a build (this is the default behavior). Those files might be other servlets that you need, for example, or configuration files needed by the server. It’s not a problem when you’re working with a workspace in Eclipse, where one project uses one directory, but when directories are shared by many files, as they are in web containers, it can be a serious problem.
To change this default behavior in Eclipse, select Project→ Properties→ Java Compiler→ Use Project Settings→ Build Path, and uncheck the “Scrub output folders on full build” checkbox, as shown in Figure 11-8. That stops Eclipse from scrubbing the output folder by default.

Figure 11-8. Avoiding output ...