Community
Participate
Working Groups
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.
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).
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).
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
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?
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).
Closing, preference is available in 2.1 recent builds.
Closing