Community
Participate
Working Groups
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:
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).
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.
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);
(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"
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.