private org.codehaus.plexus.archiver.FileSet toPlexusFileset( org.apache.maven.model.FileSet mavenFs) { DefaultFileSet plexusFs = new DefaultFileSet(); plexusFs.setDirectory(readDirectory(mavenFs)); plexusFs.setIncludes(mavenFs.getIncludes().toArray(new String[0])); plexusFs.setExcludes(mavenFs.getExcludes().toArray(new String[0])); plexusFs.setUsingDefaultExcludes(false); plexusFs.setIncludingEmptyDirectories(true); return plexusFs; }
@SuppressWarnings("ResultOfMethodCallIgnored") public void testSymlinkFileSet() throws Exception { final File zipFile = getTestFile("target/output/pasymlinks-fileset.zip"); final ZipArchiver zipArchiver = getZipArchiver(zipFile); final DefaultFileSet fs = new DefaultFileSet(); fs.setPrefix("bzz/"); fs.setDirectory(new File("src/test/resources/symlinks/src")); zipArchiver.addFileSet(fs); zipArchiver.createArchive(); final File output = getTestFile("target/output/unzipped/symlFs"); output.mkdirs(); final ZipUnArchiver zipUnArchiver = getZipUnArchiver(zipFile); zipUnArchiver.setDestFile(output); zipUnArchiver.extract(); File symDir = new File(output, "bzz/symDir"); PlexusIoResourceAttributes fa = Java7FileAttributes.uncached(symDir); assertTrue(fa.isSymbolicLink()); }