Community
Participate
Working Groups
To recreate: 1 Create a Java project and add two folders, test1 & test2. 2 Open the project properties. 3 Open Java Build Path and goto source page. 4 Add test1 as a source folder. 5 Change the output location from bin to test1. 6 Press OK to close properties page. 7 Open the properties page again and try to add test2 as a source folder. This fails. The OK button is greyed out. This fails programatically as well. Line 663 of JavaConventions is the problem. if (otherEntry.getPath().equals(output)) { return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.cannotUseDistinctSourceFolderAsOutput", entryPath.makeRelative().toString(), otherEntry.getPath().makeRelative ().toString())); //$NON-NLS-1$ } This is causing a huge problem for EJB projects and needs to be fixed ASAP.
This check is intending to capture the scenario where some source folder would output to a different entry on the classpath (using a custom output location). The scenario described in this defect should work. Candidate for backporting to 2.1 maintenance stream.
Actually, this situation is indeed meant to be forbidden. We don't want to let generated files pollute a source folder (consequence of fix for bug 33207 which was released in 2.1-rc2). We could relax this rule, the end result is not nice, but is still supported (as it was in 2.0).
For backward compatibility with 2.0, we allow the default output location to coincidate again, only specific output locations (associated with each source folder) will be denied to coincidate. Note that in your testcase, the end result can be strange if doing the following: P +-test1/ | +- p/ | +-X.java +-test2/ +- q/ +-Y.java after building (with output being test1/), you obtain P +-test1/ | +-p/ | +-X.java | +-q/ <------------ EXTRA EMPTY PACKAGE APPEARS +-test2/ +-q/ +-Y.java but presumably this doesn't bother you, right ?
Patch available in JDT/Core 2.1 update area: http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/jdt-core- home/r2.1/main.html#updates
Fixed in 2.2 stream as well.
Verified.
Verified for 3.0M1
OK