diff options
author | Roberto Sanchez | 2012-10-11 00:22:29 +0000 |
---|---|---|
committer | Roberto Sanchez | 2012-10-11 00:27:38 +0000 |
commit | 626423cef8b84495f3d7f930d35418e15f6182d6 (patch) | |
tree | 5fc8d1e56707760b2732cb3a2e7a99365852fbb5 | |
parent | 52c80965d71b67f475871da2354b072326c90fee (diff) | |
download | webtools.javaee-626423cef8b84495f3d7f930d35418e15f6182d6.tar.gz webtools.javaee-626423cef8b84495f3d7f930d35418e15f6182d6.tar.xz webtools.javaee-626423cef8b84495f3d7f930d35418e15f6182d6.zip |
[391044] EAR libraries classpath container for Utility projects in lib does not contain jars in libv201210110100
-rw-r--r-- | plugins/org.eclipse.jst.j2ee/common/org/eclipse/jst/j2ee/internal/common/classpath/J2EEComponentClasspathContainer.java | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/plugins/org.eclipse.jst.j2ee/common/org/eclipse/jst/j2ee/internal/common/classpath/J2EEComponentClasspathContainer.java b/plugins/org.eclipse.jst.j2ee/common/org/eclipse/jst/j2ee/internal/common/classpath/J2EEComponentClasspathContainer.java index c58d438f1..b0ddfc923 100644 --- a/plugins/org.eclipse.jst.j2ee/common/org/eclipse/jst/j2ee/internal/common/classpath/J2EEComponentClasspathContainer.java +++ b/plugins/org.eclipse.jst.j2ee/common/org/eclipse/jst/j2ee/internal/common/classpath/J2EEComponentClasspathContainer.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2003, 2006 IBM Corporation and others. + * Copyright (c) 2003, 2012 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -419,7 +419,7 @@ public class J2EEComponentClasspathContainer implements IClasspathContainer { // or if it is the empty string, do nothing. if (libDir != null && libDir.trim().length() != 0) { IPath libDirPath = new Path(libDir).makeRelative(); - // check if the component itself is not in the library directory of this EAR - avoid cycles in the build patch + // check if the component itself is not in the library directory of this EAR - avoid cycles in the build path IVirtualReference ref = earComp.getReference(component.getName()); if(ref != null){ IPath refPath = ref.getRuntimePath(); @@ -433,24 +433,30 @@ public class J2EEComponentClasspathContainer implements IClasspathContainer { } } refPath = refPath.makeRelative(); - if (!libDirPath.equals(refPath)) { - // retrieve the referenced components from the EAR - IVirtualReference[] earRefs = earComp.getReferences(); - for (IVirtualReference earRef : earRefs) { - if(earRef.getDependencyType() == IVirtualReference.DEPENDENCY_TYPE_USES){ - // check if the referenced component is in the library directory - IPath runtimePath = earRef.getRuntimePath().makeRelative(); - boolean isInLibDir = libDirPath.equals(runtimePath); - if(!isInLibDir && earRef.getArchiveName() != null){ - IPath fullPath = earRef.getRuntimePath().append(earRef.getArchiveName()); - isInLibDir = fullPath.removeLastSegments(1).makeRelative().equals(libDirPath); - } - if (isInLibDir) { - libRefs.add(earRef); - } + boolean onlyBinary = false; + // If this component is in the library directory, we will allow only binary entries to be + // added, to avoid cycles in the build path + if (libDirPath.equals(refPath)) { + onlyBinary = true; + } + // retrieve the referenced components from the EAR + IVirtualReference[] earRefs = earComp.getReferences(); + for (IVirtualReference earRef : earRefs) { + if(earRef.getDependencyType() == IVirtualReference.DEPENDENCY_TYPE_USES){ + // check if the referenced component is in the library directory + IPath runtimePath = earRef.getRuntimePath().makeRelative(); + boolean isInLibDir = libDirPath.equals(runtimePath); + if(!isInLibDir && earRef.getArchiveName() != null){ + IPath fullPath = earRef.getRuntimePath().append(earRef.getArchiveName()); + isInLibDir = fullPath.removeLastSegments(1).makeRelative().equals(libDirPath); + } + if (isInLibDir) { + if (!onlyBinary || (onlyBinary && earRef.getReferencedComponent().isBinary())) + libRefs.add(earRef); } } } + //add EAR classpath container refs try { ClasspathLibraryExpander classpathLibExpander = new ClasspathLibraryExpander(earComp); |