Bug 363863 - New Java Build Path Problem.
Summary: New Java Build Path Problem.
Status: VERIFIED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.8   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.8   Edit
Assignee: Jay Arthanareeswaran CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-15 14:46 EST by Salvador Zalapa CLA
Modified: 2012-04-30 01:26 EDT (History)
5 users (show)

See Also:


Attachments
Java Build Path Page (28.04 KB, image/jpeg)
2011-11-15 14:48 EST, Salvador Zalapa CLA
no flags Details
Java Build Page Error (14.90 KB, image/jpeg)
2011-11-15 14:48 EST, Salvador Zalapa CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Salvador Zalapa CLA 2011-11-15 14:46:54 EST
Build Identifier: M20111020-1539

I am using JDT:
Version: 3.6.2.r362_v20101117
Build id: M20111020-1539
with
Eclipse Platform:
Version: 3.6.3.r362_v20110302
Build id: M20111020-1539

In a Java Project when an extra source folder is added, and the output folder value is the same that a source folder ( see the java build path page image ), you will get a Java Build Path problem ( see the second image ):

Source folder 'SecondSorce' in project 'MyJavaProject' cannot output to distinct source folder 'src'

This java build path problem was not shown in previous version, what does it mean? it is working as design?

Reproducible: Always

Steps to Reproduce:
1.Create a Java Project
2.Change the "Default output folder" to a source folder name ( src if you created it with the default values)
3.Create a second source folder "SecondSource"
Comment 1 Salvador Zalapa CLA 2011-11-15 14:48:01 EST
Created attachment 207049 [details]
Java Build Path Page
Comment 2 Salvador Zalapa CLA 2011-11-15 14:48:50 EST
Created attachment 207050 [details]
Java Build Page Error
Comment 3 Srikanth Sankaran CLA 2011-11-15 19:19:17 EST
This is intentional. See bug 287164. Closing as WORKSFORME as this is
the expected behavior.
Comment 4 Satyam Kandula CLA 2011-12-05 03:14:39 EST
Verified for 3.8M4 using build I20111202-0800
Comment 5 Chuck Bridgham CLA 2011-12-06 17:05:14 EST
I would like to re-open this bug to consider the existing scenario that is now broken because of this change.

We have an adopter product that uses the same src folder as the output of the project.

src1 - > src1

This has the benefits of maintaining both java and non - java artifacts in an existing structure, without the need to physically copy the non-java artifacts.

This project has annotation processors activated, and by default, will create the .apt_generated source folder, also using the "src1" output folder.

It is understood that non java artifacts in the .apt_generated folder will not be copied.

We understand this isn't an optimum project setup, and the limitations of JDT in this area, but it seems a warning is more appropriate.

Now in the Juno release, this project setup is no longer allowed, and existing customers will be forced to change their project settings.  This is not great.
Comment 6 Srikanth Sankaran CLA 2011-12-06 17:19:54 EST
We may to consider special case handling for this configuration.
Jay, please study this.
Comment 7 Dani Megert CLA 2011-12-07 03:31:25 EST
The problem shows up as a warning and not as an error in builds < 3.8. We won't change that, as such a setup can be dangerous (see bug 287164).

Also note, that with 3.8 and newer builds, this will be an error by default.
Comment 8 Satyam Kandula CLA 2011-12-07 03:44:55 EST
(In reply to comment #7)
> The problem shows up as a warning and not as an error in builds < 3.8. We won't
> change that, as such a setup can be dangerous (see bug 287164).
> 
> Also note, that with 3.8 and newer builds, this will be an error by default.
Just to add, this error can be configured to be a warning or ignored in 3.8.
Comment 9 Chuck Bridgham CLA 2011-12-07 09:40:28 EST
I assume when you say can be configured, you mean via a product preference?  So users don't need to set the preferences themselves?
Comment 10 Satyam Kandula CLA 2011-12-07 23:14:31 EST
(In reply to comment #9)
> I assume when you say can be configured, you mean via a product preference?  So
> users don't need to set the preferences themselves?
This can be a workspace or a project preference. If users have to create a project through your product interface, you could modify this preference. Otherwise, users might have to modify the preference.
Comment 11 Dani Megert CLA 2011-12-08 03:40:40 EST
(In reply to comment #10)
> (In reply to comment #9)
> > I assume when you say can be configured, you mean via a product preference?  
> > users don't need to set the preferences themselves?
> This can be a workspace or a project preference. If users have to create a
> project through your product interface, you could modify this preference.
> Otherwise, users might have to modify the preference.

This is not entirely true. Since it is a "normal" preference one can also set it via plug-in preferences customization:

1. Create a file with the default preferences if there isn't one already.
2. Add the following line to that file:
org.eclipse.jdt.core/org.eclipse.jdt.core.classpath.outputOverlappingAnotherSource=error
--- or: ---
org.eclipse.jdt.core/org.eclipse.jdt.core.classpath.outputOverlappingAnotherSource=ignore
3. Start Eclipse with either
   -pluginCustomization <file location>
   -vmargs Declipse.pluginCustomization=<file location>

This works for 3.6.2+, 3.7.x and 3.8.
Comment 12 Satyam Kandula CLA 2012-04-30 01:26:01 EDT
Verified for 3.8M7