use of org.codehaus.plexus.components.io.resources.PlexusIoFileResource in project docker-maven-plugin by fabric8io.
the class MappingTrackArchiver method getAssemblyFiles.
/**
* Get all files depicted by this assembly.
*
* @return assembled files
*/
public AssemblyFiles getAssemblyFiles(MavenSession session) {
AssemblyFiles ret = new AssemblyFiles(new File(getDestFile().getParentFile(), assemblyName));
// Where the 'real' files are copied to
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;
}
Aggregations