if (SubDeploymentMarker.isSubDeployment(resourceRoot) && resourceRoot != deploymentRoot) {
continue;
}
// if this resource root represents an additional module then we need
// to add the class path entry to the additional module
final Attachable target;
if (additionalModules.containsKey(resourceRoot.getRoot())) {
target = additionalModules.get(resourceRoot.getRoot());
} else {
target = deploymentUnit;
}
final String[] items = getClassPathEntries(resourceRoot);
for (String item : items) {
//first try and resolve relative to the manifest resource root
boolean found = false;
final VirtualFile classPathFile = resourceRoot.getRoot().getParent().getChild(item);
final VirtualFile topLevelClassPathFile = deploymentRoot.getRoot().getParent().getChild(item);
if (isInside(classPathFile, topLevelRoot)) {
if (earLibJars.contains(classPathFile)) {
log.debugf("Class-Path entry %s in %s ignored, as target is in or referenced by /lib", classPathFile,
resourceRoot.getRoot());
} else if (additionalModules.containsKey(classPathFile)) {
target.addToAttachmentList(Attachments.CLASS_PATH_ENTRIES, additionalModules.get(classPathFile)
.getModuleIdentifier());
} else if (subDeploymentModules.containsKey(classPathFile)) {
target.addToAttachmentList(Attachments.CLASS_PATH_ENTRIES, subDeploymentModules.get(classPathFile));
} else if (additionalModules.containsKey(topLevelClassPathFile)) {
//if not found try resolving the class path entry from the deployment root
target.addToAttachmentList(Attachments.CLASS_PATH_ENTRIES, additionalModules.get(topLevelClassPathFile)
.getModuleIdentifier());
} else if (subDeploymentModules.containsKey(topLevelClassPathFile)) {
//if not found try resolving the class path entry from the deployment root
target.addToAttachmentList(Attachments.CLASS_PATH_ENTRIES, subDeploymentModules.get(topLevelClassPathFile));
} else if(classPathFile.exists() && classPathFile.isDirectory()) {
} else if(topLevelClassPathFile.exists() && topLevelClassPathFile.isDirectory()) {
} else {
log.warn("Class Path entry " + item + " in " + resourceRoot.getRoot() + " does not point to a valid jar for a Class-Path reference.");
}
} else if (item.startsWith("/")) {
ModuleIdentifier moduleIdentifier = externalModuleService.addExternalModule(item);
target.addToAttachmentList(Attachments.CLASS_PATH_ENTRIES, moduleIdentifier);
log.debugf("Resource %s added as external jar %s", classPathFile, resourceRoot.getRoot());
} else {
//ignore
log.debugf("Ignoring missing Class-Path entry %s", classPathFile);
}