Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 343064

Summary: "Project 'x' cannot reference itself" when Dynamic Web Module embeds a java project
Product: [WebTools] WTP Java EE Tools Reporter: Giampaolo Tomassoni <giampaolo>
Component: jst.servletAssignee: Chuck Bridgham <cbridgha>
Status: NEW --- QA Contact: Chuck Bridgham <cbridgha>
Severity: enhancement    
Priority: P3 CC: ccc
Version: 3.2.3   
Target Milestone: Future   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Giampaolo Tomassoni CLA 2011-04-17 09:50:06 EDT
Build Identifier: 20110301-1815

When a Dynamic Web Module embeds a java project via Deployment Assembly, an attempt to have the latter refer to the Web App Libraries of the first via Java Build Path, would result in a "Project 'x' cannot reference itself" (where 'x' is the java project name).

It is common to put, into a WebApp's WEB-INF/lib directory, libraries which end using the same Web environment of the WebApp. Modules using some jsp/jsf feature, in example, are generally put there and they expect to share the same classpath of the web application itself.

The intention of referring to the Web App Libraries from 'lib' is not to reference the 'lib' module itself, but instead to share the war classpath. So, the "Project 'lib' cannot reference itself" error isn't due (at least) in this context, because 'lib' is going to share a common classpath, in which incidentally itself must be present.

Reproducible: Always

Steps to Reproduce:
1. File->New->Project->Dynamic Web Project; say Project name is 'web'.
2. File->New->Project->Java->Java Project; say Project name is 'lib'.
3. In the Deployment Assembly panel from project 'web', Add->Project->lib
4. In Java Build Path from project 'lib', Libraries->Add Library->Web App Libraries->'web'
Comment 1 Carl Anderson CLA 2011-04-18 17:58:25 EDT
Giampaolo, judging by the date, I assume that this is from Helios SR2?  (Eclipse 3.6.2)  If that is correct, then this corresponds to WTP 3.2.3
Comment 2 Giampaolo Tomassoni CLA 2011-04-19 02:40:27 EDT
Right.
Comment 3 Carl Anderson CLA 2011-08-15 15:13:33 EDT
Assigning to Chuck for initial investigation.
Comment 4 Chuck Bridgham CLA 2011-10-13 13:42:53 EDT
This would be a major change to allow cyclical dependencies in this form.

I understand the need to share web libraries on the classpath, but this scenario breaks JDT classpath rules, and another solution that may include exclusion rules needs to be investigated.
Comment 5 Giampaolo Tomassoni CLA 2011-10-13 14:10:09 EDT
From what you write I see it isn't that easy to fix this.

I'm not willing to argue in any way with your decision, but I would like to outline the fact that this problem had been introduced with recent versions of eclipse. Galileo, in example, did show the correct behaviour about this case.

So, I wouldn't rate this bug as an "enhancement": it is at least a backward-compatibility issue.