use of org.apache.maven.shared.utils.io.DirectoryScanner 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;
}
use of org.apache.maven.shared.utils.io.DirectoryScanner in project fabric8-maven-plugin by fabric8io.
the class AbstractAppServerHandler method scanFiles.
/**
* Scan the project's output directory for certain files.
*
* @param patterns one or more patterns which fit to Maven's include syntax
* @return list of files found
*/
protected String[] scanFiles(String... patterns) {
String buildOutputDir = project.getBuild().getDirectory();
if (buildOutputDir != null && new File(buildOutputDir).exists()) {
DirectoryScanner directoryScanner = new DirectoryScanner();
directoryScanner.setBasedir(buildOutputDir);
directoryScanner.setIncludes(patterns);
directoryScanner.scan();
return directoryScanner.getIncludedFiles();
} else {
return new String[0];
}
}
Aggregations