Bug 196483 - Automatically create folders referred as source on classpath
Summary: Automatically create folders referred as source on classpath
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0.2   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-07-13 12:54 EDT by Grant Taylor CLA
Modified: 2008-08-27 06:57 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Grant Taylor CLA 2007-07-13 12:54:28 EDT
Build ID: 200503110845

Steps To Reproduce:
1. Create a simple Java project, using "src" as the source directory
2. Check this project into CVS
3. Delete project from workspace
4. Check out the project from CVS
You get a build error because the "src" folder doesn't exist.
5. Create the "src" folder
6. Perform a team update
The "src" folder is deleted again, forcing the user to fix it again.

The above steps might seem silly or fringe because a pure Java project will normally have some source.  However in our product, we generate Java to a source folder.  Not all artifact kinds require Java code, so having an empty source folder is very common.  The user can fix the problem by changing the "prune empty directories" setting.  Is there a reason why this is set to "true" by default?  For our product, it would be much better if empty directories were not pruned.  Also see defect 196482.  We can't override this preference in our product due to 196482.


More information:
Comment 1 Michael Valenta CLA 2007-07-16 09:27:22 EDT
The default setting must be true because of how CVS manages directories. If pruning is off, all directories that even existed will be created on the client. Since the error is coming from JDT, I'm moving this bug to them. Perhaps they need to add support for projects that contain generated source (i.e. if the project contains generated source, they shouldn't signal an error on the source tree until the source is generated).
Comment 2 Grant Taylor CLA 2007-07-16 09:37:01 EDT
Ah, I didn't know that CVS handled directories that way.  They don't have the concept of deleted folders?  I'll save my gripes for them, I guess:)  My initial take on the problem is that JDT should just try and create source folders that don't exists instead of creating error markers.  Why force the user to do something that we can do for them?  In a product like ours where users may not be familiar with Java, the problem becomes much worse.
Comment 3 Jerome Lanneluc CLA 2007-08-09 10:54:49 EDT
This is not ideal, but since you manipulate JDT/Core APIs, you could change the source entry to be optional:

IJavaProject javaProject = ...
IClasspathAttribute attribute = JavaCore.newClasspathAttribute(IClasspathAttribute.OPTIONAL, "true");
IClasspathEntry[] classpath = 
			new IClasspathEntry[] {
				JavaCore.newSourceEntry(new Path("/P/src"), new IPath[0], new IPath[0], null, new IClasspathAttribute[] {attribute})
			};
javaProject.setRawClasspath(classpath, null);
Comment 4 Jerome Lanneluc CLA 2008-08-27 06:56:23 EDT
(In reply to comment #2)
Changing title from "CVS UI:  change default preference setting for pruning empty directories" to "Automatically create folders referred as source on classpath"
Comment 5 Jerome Lanneluc CLA 2008-08-27 06:57:23 EDT
I'm not sure how we can differentiate the case where the user had a typo in the classpath entry, and the case where the folder is simply missing.