问题
I have small project consisting of one maven project and two maven modules. One of the modules is a webapp, and I'm using WTP to run all my web applications. Everything has been fine, until today when when the webapp started refusing to compile, citing:
Project 'sdx.client' cannot reference itself
If I remove the following line from the .classpath
:
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
my project compiles again. From googling, I believe this is a WTP element, but I'm not really sure what it does and why it believes that it contains a reflexive reference to the project containing it. Suggestions for where to look to track down the source of the problem would be very welcome.
Update
I haven't solved the problem, but I did make the symptoms go away by deleting the project and checking it out again from svn. So it looks like a bug somewhere, but I'm not sure where to report it or how to propose a decision procedure to determine when it's fixed.
回答1:
There is a discussion earlier this year in dev-eclipse: http://dev.eclipse.org/newslists/news.eclipse.webtools/msg18400.html which suggests this may be a bug.
回答2:
I had the same problem and found a way to fix it via the .classpath file in my project: This entry was causing the problem:
<classpathentry kind="lib" path="C:/....jar">
<attributes>
<attribute name="javadoc_location" value="jar:file:/C:/....jar!/"/>
</attributes>
</classpathentry>
Comparing with a previous version, it turned out the following line went missing, after the <attribute name=...> line. Adding it again made the problem go away:
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
Not sure how to explain it, but perhaps it helps somebody.
来源:https://stackoverflow.com/questions/1928277/eclipse-problem-project-references-itself