Community
Participate
Working Groups
Build ID: M20070212-1330 Steps To Reproduce: My project is WTP and Maven enabled. I have upgraded Eclipse wia standard update procedure. Now my project is not showing source packages. 1.Open Project's Properties > Java Build Path 2.Tab Source contains no entries. By adding new Folder with my source java files a warning pops up saying I have a duplicate entry in my build path. More information: This is my .classpath <?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v5.5"/> <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/> <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="output" path="build/classes"/> </classpath> Obviously there is no source entry, so packages are not showing in my Package Explorer. But when trying to add source folder, it says I have duplicate entries!
Created attachment 59632 [details] A dialog with warning of duplicate classpath entry
Could it be that one of the classpath containers already define this source entry ? They should not but we don't check for this and this would result in this message.
I wonder if we shouldn't silently ignore such a scenario. This is no user mistake, and we could recover easily (only keep the first instance).
I have reproduced this issue on Eclipse 3.4M4. It's very strange, it only appears on web project (which is WTP and Maven 2 enabled). Eclipse's validation prevent to build this project. Furthermore, the same project works fine with Eclipse 3.3. My pom.xml is the following : <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.cedric.a01</groupId> <artifactId>test</artifactId> <packaging>war</packaging> <version>1.0-SNAPSHOT</version> <name>Test Struts Maven Webapp</name> <url>http://maven.apache.org</url> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> <dependency> <groupId>org.apache.struts</groupId> <artifactId>struts-core</artifactId> <version>1.3.8</version> </dependency> <dependency> <groupId>org.apache.struts</groupId> <artifactId>struts-extras</artifactId> <version>1.3.8</version> </dependency> <dependency> <groupId>org.apache.struts</groupId> <artifactId>struts-taglib</artifactId> <version>1.3.8</version> </dependency> </dependencies> <build> <finalName>test</finalName> <sourceDirectory>src/main/java</sourceDirectory> <testSourceDirectory>src/test/java</testSourceDirectory> <resources> <resource> <directory>src/main/resources</directory> </resource> </resources> <testResources> <testResource> <directory>src/test/resources</directory> </testResource> </testResources> <pluginManagement> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.0.2</version> <configuration> <source>1.5</source> <target>1.5</target> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-eclipse-plugin</artifactId> <version>2.4</version> <configuration> <downloadSources>true</downloadSources> <wtpContextName>codex</wtpContextName> <wtpversion>1.5</wtpversion> <classpathContainers> <classpathContainer> org.eclipse.jdt.launching.JRE_CONTAINER </classpathContainer> <classpathContainer> org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v6.0.13 </classpathContainer> <classpathContainer> org.eclipse.jst.j2ee.internal.module.container </classpathContainer> <classpathContainer> org.eclipse.jst.j2ee.internal.web.container </classpathContainer> </classpathContainers> <additionalProjectnatures> <projectnature> org.eclipse.wst.common.project.facet.core.nature </projectnature> <projectnature> org.eclipse.jdt.core.javanature </projectnature> <projectnature> org.eclipse.wst.common.modulecore.ModuleCoreNature </projectnature> <projectnature> org.eclipse.jem.workbench.JavaEMFNature </projectnature> <projectnature> org.eclipse.wst.jsdt.core.jsNature </projectnature> </additionalProjectnatures> </configuration> </plugin> </plugins> </pluginManagement> </build> </project>
I think you can force it to build still in presence of buildpath errors (as a workaround). Look under: Preferences>Java>Compiler>Building>Abort build when build path errors occur (disable the check box).
*** Bug 194006 has been marked as a duplicate of this bug. ***
*** Bug 183297 has been marked as a duplicate of this bug. ***
Reducing severity since there is a workaround.
Created attachment 114820 [details] Proposed fix and regression tests This fix consists in checking duplicate entries at the raw classpath level only. If entries are duplicate because of the resolution, only the first entry is kept (this is what we've done until now since we always lookup entries in the resolved classpath order).
Fix and tests released for 3.5M3
*** Bug 251540 has been marked as a duplicate of this bug. ***
Created attachment 116045 [details] Same fix and tests for R3_4_maintenance
(In reply to comment #12) > Created an attachment (id=116045) [details] > Same fix and tests for R3_4_maintenance > Thanks for the patch to 3.4 per 251540
Philippe, ok to backport to 3.4.2? This limitation just annoys users and the fix is quite safe.
I am a bit puzzled by the API refinement: + * <p> + * Since 3.5, if the resolution creates duplicate entries + * (i.e. {@link IClasspathEntry entries} which are {@link Object#equals(Object)}), + * only the first one is added to the resolved classpath. + * </p> would this be ok for 3.4 ?
Created attachment 116185 [details] Same fix with improved wordings and same tests for R3_4_maintenance
Verified for 3.5M3 using I20081026-2000
+1 for 3.4.2
Fix and tests released for 3.4.2
Verified for 3.4.2 by running ClasspathTests v_894_R34x in a 3.4.1 wksp