if (overlay.shouldSkip()) {
continue;
}
Artifact artifact = overlay.getArtifact();
IOverlayVirtualComponent overlayComponent = null;
IMavenProjectFacade workspaceDependency = projectManager.getMavenProject(
artifact.getGroupId(),
artifact.getArtifactId(),
artifact.getVersion());
if(workspaceDependency != null) {
//artifact dependency is a workspace project && dependency resolution is on
IProject overlayProject = workspaceDependency.getProject();
if (overlayProject.equals(project)) {
overlayComponent = OverlayComponentCore.createSelfOverlayComponent(project);
} else if (workspaceDependency.getFullPath(artifact.getFile()) != null){
overlayComponent = OverlayComponentCore.createOverlayComponent(overlayProject);
} else {
//Dependency resolution is off
overlayComponent = createOverlayArchiveComponent(project, mavenProject, overlay);
}
} else {
overlayComponent = createOverlayArchiveComponent(project, mavenProject, overlay);
}
if (overlayComponent != null) {
overlayComponent.setInclusions(new LinkedHashSet<String>(Arrays.asList(overlay.getIncludes())));
overlayComponent.setExclusions(new LinkedHashSet<String>(Arrays.asList(overlay.getExcludes())));
IVirtualReference depRef = ComponentCore.createReference(warComponent, overlayComponent);
String targetPath = StringUtils.nullOrEmpty(overlay.getTargetPath())?"/":overlay.getTargetPath(); //$NON-NLS-1$
depRef.setRuntimePath(new Path(targetPath));
newOverlayRefs.add(depRef);