void (Set<? extends Library> libraries, ArtifactRootElement<?> root, CompositePackagingElement<?> archive, List<? super String> classpath) { PackagingElementFactory factory = PackagingElementFactory.getInstance(); for (Library library : libraries) { if (LibraryPackagingElement.getKindForLibrary(library).containsDirectoriesWithClasses()) { for (VirtualFile classesRoot : library.getFiles(OrderRootType.CLASSES)) { if (classesRoot.isInLocalFileSystem()) { archive.addOrFindChild(factory.createDirectoryCopyWithParentDirectories(classesRoot.getPath(), "/")); } else { final PackagingElement<?> child = factory.createFileCopyWithParentDirectories(VfsUtil.getLocalFile(classesRoot).getPath(), "/"); root.addOrFindChild(child); classpath.addAll(ManifestFileUtil.getClasspathForElements(Collections.singletonList(child), myContext, PlainArtifactType.getInstance())); } } } else { final List<? extends PackagingElement<?>> children = factory.createLibraryElements(library); classpath.addAll(ManifestFileUtil.getClasspathForElements(children, myContext, PlainArtifactType.getInstance())); root.addOrFindChildren(children); } } }