public void expandArtifact(File artifactFile) throws IOException { JarFile jarFile = new JarFile(artifactFile); Enumeration<JarEntry> entries = jarFile.entries(); while (entries.hasMoreElements()) { JarEntry each = entries.nextElement(); if (each.getName().startsWith("META-INF")) { continue; } if (each.isDirectory()) { continue; } this.archive.add(new ZipFileEntryAsset(jarFile, each), each.getName()); } }
archive.add(new ZipFileEntryAsset(new File(file.getName()), entry), new BasicPath(entryName));
private ZipImporter importFrom(final ZipFile file, Filter<ArchivePath> filter) throws ArchiveImportException { Validate.notNull(file, "File must be specified"); try { Enumeration<? extends ZipEntry> entries = file.entries(); while (entries.hasMoreElements()) { ZipEntry entry = entries.nextElement(); // Get the entry (path) name final String entryName = entry.getName(); if(!filter.include(ArchivePaths.create(entryName))) { continue; } // Get the archive final Archive<?> archive = this.getArchive(); // Handle directories separately if (entry.isDirectory()) { archive.addAsDirectory(entryName); continue; } archive.add(new ZipFileEntryAsset(file, entry), new BasicPath(entryName)); } } catch (Exception e) { throw new ArchiveImportException("Could not import file", e); } return this; } }