Bug 7293 - Scrubbing Output Directory Can Cause Havoc
Summary: Scrubbing Output Directory Can Cause Havoc
Status: RESOLVED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 1.0   Edit
Hardware: PC Windows 2000
: P3 critical (vote)
Target Milestone: 2.1 RC1   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-01-05 15:35 EST by Peter Bryant CLA
Modified: 2003-02-14 09:33 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Bryant CLA 2002-01-05 15:35:39 EST
I started using Eclipse.  I imported an existing project.  I set up the ouput 
directory.  My output directory contains (at the top level) some resource 
files.  When you go to build (or was it even refresh from local file?) Eclipse 
scrubs (i.e. deletes files) from the output directory.

Since my output directory contained resource files.  These were deleted.

As it happened they contained uncommitted code and I've lost about a days work.

Now I can live with the fact that an output directory has to be scrubbed each 
time (if there were some documentation on how I get my resource files into that 
directory with each build).

What I cannot live with (and the bug I am reporting) is the fact that Eclipse 
removes files it does not know about (or rather, that it has not itself 
created) without at least a warning.
Comment 1 Philipe Mulet CLA 2002-01-10 06:03:53 EST
The output folder is fully owned by the Java builder. In order to get resources 
into it, they have to be located inside source folder (next to .java files).

Then the Java builder will copy these resources along with generated .class 
files into the output folder. The motivation was to avoid having to put source 
folders on the runtime classpath for getting resources, and putting resources 
next to source files was somewhat interesting. You can still separate your 
resources from source files, by simply adding an extra source folder ('rsc') on 
your classpath so as to group them all if you want.

Then you can forget about the output folder alltogether, leaving it to the Java 
builder to maintain).
Comment 2 Peter Bryant CLA 2002-01-10 14:02:05 EST
OK.  that is a fine explanation and I can understand exactly why you do it this 
way.  However, the 'bug' I am reporting is:

"What I cannot live with (and the bug I am reporting) is the fact that Eclipse 
removes files it does not know about (or rather, that it has not itself 
created) without at least a warning."

In my case the scrubbing lost me a lot of work.  And I would imagine it will 
affect other people who are using Eclipse on an existing project.

How about this:

The builder keeps a record of whether or not it has used the output/build 
directory before (in meta data somewhere, or by placing a file in this 
directory).

When you go to build if there are files in the output directory, the IDE needs 
to ask "We will be deleting all files in xxxx is it ok to proceed?".  The IDE 
then records that it has used the output directory (i.e. now has control over 
it).  Subsequent builds, there is no (or not as much) need to prompt).
Comment 3 Philipe Mulet CLA 2002-01-30 07:24:13 EST
This approach was envisaged (see 
http://dev.eclipse.org/viewcvs/index.cgi/~checkout~/org.eclipse.jdt.core/notes/r
2.0/output%20folder/output-folder.html?rev=1.4.2.2&content-type=text/plain) and 
rejected, at least for the short term.

Just consider the Java builder output folder as fully owned by the Java builder 
(think of it as a /tmp folder), given it is managed by an Eclipse builder, only 
another Eclipse builder can interfere with it in a satisfactory way.

We might revisit this post 2.0, so will keep it for LATER
Comment 4 Brian Matzon CLA 2002-12-20 16:35:59 EST
zap - there went my resource files too :/
This bug is rather annoying! - I work in an environment with multiple editors,
and fixed positions of files/directories. I have no possibility of placing
resource files anywhere else. our ant script *relies* on the resource files
being positioned at the root of the class files.

The only other option is to make two directories for files, one for eclipse
files, and one for ant - but this is lame. I would have to compile two times
each time I make a modification.

This (IMO) is a critical bug that needs to be solved ASAP. What are the
technical reasons for wiping the whole directory, instead of comparing from
source directories?
Comment 5 Philipe Mulet CLA 2003-01-09 05:42:50 EST
One addition in M4 builds is the possibility to tell the Java builder to never 
clean the output folders. See preferences: 
Window>Preferences>Java>Compiler>Others>Allow to clean output folders for a 
full build.

(also note that you can change this preference on a per project basis using 
project preferences instead).

Comment 6 Philipe Mulet CLA 2003-02-14 09:32:21 EST
Closing, preference is available in 2.1 recent builds.
Comment 7 Philipe Mulet CLA 2003-02-14 09:33:11 EST
Closing