@Test(expected = IllegalArgumentException.class) public void noDirectory() throws Exception { archiver.setDestFile(new File(".")); archiver.addDirectory(new File(System.getProperty("user.home")), "tmp"); AssemblyFiles files = archiver.getAssemblyFiles(session); }
public AssemblyFiles getAssemblyFiles(MavenSession session) { AssemblyFiles ret = new AssemblyFiles(new File(getDestFile().getParentFile(), assemblyName)); for (Addition addition : added) { Object resource = addition.resource; File target = new File(ret.getAssemblyDirectory(), addition.destination); if (resource instanceof File && addition.destination != null) { addFileEntry(ret, session, (File) resource, target); } else if (resource instanceof PlexusIoFileResource) { addFileEntry(ret, session, ((PlexusIoFileResource) resource).getFile(), target); } else if (resource instanceof FileSet) { FileSet fs = (FileSet) resource; DirectoryScanner ds = new DirectoryScanner(); File base = addition.directory; ds.setBasedir(base); ds.setIncludes(fs.getIncludes()); ds.setExcludes(fs.getExcludes()); ds.setCaseSensitive(fs.isCaseSensitive()); ds.scan(); for (String f : ds.getIncludedFiles()) { File source = new File(base, f); File subTarget = new File(target, f); addFileEntry(ret, session, source, subTarget); } } else { throw new IllegalStateException("Unknown resource type " + resource.getClass() + ": " + resource); } } return ret; }
MappingTrackArchiver extends TrackingArchiver { public AssemblyFiles getAssemblyFiles(MavenSession session) { AssemblyFiles ret = new AssemblyFiles(new File(getDestFile().getParentFile(), assemblyName)); for (Addition addition : added) { Object resource = addition.resource; File target = new File(ret.getAssemblyDirectory(), addition.destination); if (resource instanceof File && addition.destination != null) { addFileEntry(ret, session, (File) resource, target); } else if (resource instanceof PlexusIoFileResource) { addFileEntry(ret, session, ((PlexusIoFileResource) resource).getFile(), target); } else if (resource instanceof FileSet) { FileSet fs = (FileSet) resource; DirectoryScanner ds = new DirectoryScanner(); File base = addition.directory; ds.setBasedir(base); ds.setIncludes(fs.getIncludes()); ds.setExcludes(fs.getExcludes()); ds.setCaseSensitive(fs.isCaseSensitive()); ds.scan(); for (String f : ds.getIncludedFiles()) { File source = new File(base, f); File subTarget = new File(target, f); addFileEntry(ret, session, source, subTarget); } } else { throw new IllegalStateException("Unknown resource type " + resource.getClass() + ": " + resource); } } return ret; } }
MappingTrackArchiver extends TrackingArchiver { public AssemblyFiles getAssemblyFiles(MavenSession session) { AssemblyFiles ret = new AssemblyFiles(new File(getDestFile().getParentFile(), assemblyName)); for (Addition addition : added) { Object resource = addition.resource; File target = new File(ret.getAssemblyDirectory(), addition.destination); if (resource instanceof File && addition.destination != null) { addFileEntry(ret, session, (File) resource, target); } else if (resource instanceof PlexusIoFileResource) { addFileEntry(ret, session, ((PlexusIoFileResource) resource).getFile(), target); } else if (resource instanceof FileSet) { FileSet fs = (FileSet) resource; DirectoryScanner ds = new DirectoryScanner(); File base = addition.directory; ds.setBasedir(base); ds.setIncludes(fs.getIncludes()); ds.setExcludes(fs.getExcludes()); ds.setCaseSensitive(fs.isCaseSensitive()); ds.scan(); for (String f : ds.getIncludedFiles()) { File source = new File(base, f); File subTarget = new File(target, f); addFileEntry(ret, session, source, subTarget); } } else { throw new IllegalStateException("Unknown resource type " + resource.getClass() + ": " + resource); } } return ret; }  }
MappingTrackArchiver extends TrackingArchiver { public AssemblyFiles getAssemblyFiles(MavenSession session) { AssemblyFiles ret = new AssemblyFiles(new File(getDestFile().getParentFile(), assemblyName)); for (Addition addition : added) { Object resource = addition.resource; File target = new File(ret.getAssemblyDirectory(), addition.destination); if (resource instanceof File && addition.destination != null) { addFileEntry(ret, session, (File) resource, target); } else if (resource instanceof PlexusIoFileResource) { addFileEntry(ret, session, ((PlexusIoFileResource) resource).getFile(), target); } else if (resource instanceof FileSet) { FileSet fs = (FileSet) resource; DirectoryScanner ds = new DirectoryScanner(); File base = addition.directory; ds.setBasedir(base); ds.setIncludes(fs.getIncludes()); ds.setExcludes(fs.getExcludes()); ds.setCaseSensitive(fs.isCaseSensitive()); ds.scan(); for (String f : ds.getIncludedFiles()) { File source = new File(base, f); File subTarget = new File(target, f); addFileEntry(ret, session, source, subTarget); } } else { throw new IllegalStateException("Unknown resource type " + resource.getClass() + ": " + resource); } } return ret; }  AssemblyFiles getAssemblyFiles(MavenSession session); void init(KitLogger log, String assemblyName); }
MappingTrackArchiver extends TrackingArchiver { public AssemblyFiles getAssemblyFiles(MavenSession session) { AssemblyFiles ret = new AssemblyFiles(new File(getDestFile().getParentFile(), assemblyName)); for (Addition addition : added) { Object resource = addition.resource; File target = new File(ret.getAssemblyDirectory(), addition.destination); if (resource instanceof File && addition.destination != null) { addFileEntry(ret, session, (File) resource, target); } else if (resource instanceof PlexusIoFileResource) { addFileEntry(ret, session, ((PlexusIoFileResource) resource).getFile(), target); } else if (resource instanceof FileSet) { FileSet fs = (FileSet) resource; DirectoryScanner ds = new DirectoryScanner(); File base = addition.directory; ds.setBasedir(base); ds.setIncludes(fs.getIncludes()); ds.setExcludes(fs.getExcludes()); ds.setCaseSensitive(fs.isCaseSensitive()); ds.scan(); for (String f : ds.getIncludedFiles()) { File source = new File(base, f); File subTarget = new File(target, f); addFileEntry(ret, session, source, subTarget); } } else { throw new IllegalStateException("Unknown resource type " + resource.getClass() + ": " + resource); } } return ret; }  AssemblyFiles getAssemblyFiles(MavenSession session); void init(KitLogger log, String assemblyName);  }