### Eclipse Workspace Patch 1.0 #P org.eclipse.jst.j2ee Index: common/org/eclipse/jst/j2ee/internal/common/classpath/J2EEComponentClasspathContainer.java =================================================================== RCS file: /cvsroot/webtools/jeetools/plugins/org.eclipse.jst.j2ee/common/org/eclipse/jst/j2ee/internal/common/classpath/J2EEComponentClasspathContainer.java,v retrieving revision 1.27.2.6 diff -u -r1.27.2.6 J2EEComponentClasspathContainer.java --- common/org/eclipse/jst/j2ee/internal/common/classpath/J2EEComponentClasspathContainer.java 27 Feb 2009 20:58:02 -0000 1.27.2.6 +++ common/org/eclipse/jst/j2ee/internal/common/classpath/J2EEComponentClasspathContainer.java 16 Mar 2009 22:04:32 -0000 @@ -212,17 +212,31 @@ if (!libDir.equals(earComp.getReference(component.getName()).getRuntimePath().toString())) { // retrieve the referenced components from the EAR IVirtualReference[] earRefs = earComp.getReferences(); + String prefix = libDir; + if (prefix.startsWith("/")) { + prefix=prefix.substring(1); + } + if (!prefix.endsWith("/")) { + prefix=prefix + "/"; + } for (IVirtualReference earRef : earRefs) { // check if the referenced component is in the library directory + IVirtualComponent earRefComp = earRef.getReferencedComponent(); + boolean isCandidate = false; if (libDir.equals(earRef.getRuntimePath().toString())) { - IVirtualComponent earRefComp = earRef.getReferencedComponent(); - // check if the referenced component is already visited - avoid cycles in the build path - if (!refedComps.contains(earRefComp)) { - // visit the referenced component - refsList.add(earRef); - refedComps.add(earRefComp); + isCandidate = true; + } else { + String archiveName = earRef.getArchiveName(); + if (archiveName != null && archiveName.startsWith(prefix)) { + isCandidate = true; } } + // check if the referenced component is already visited - avoid cycles in the build path + if (isCandidate && !refedComps.contains(earRefComp)) { + // visit the referenced component + refsList.add(earRef); + refedComps.add(earRefComp); + } } } }