use of org.apache.maven.archetype.metadata.FileSet in project maven-archetype by apache.
the class FilesetArchetypeCreator method createArchetypeFiles.
private void createArchetypeFiles(Properties reverseProperties, List<FileSet> fileSets, String packageName, File basedir, File archetypeFilesDirectory, String defaultEncoding, List<String> excludePatterns) throws IOException {
getLogger().debug("Creating Archetype/Module files from " + basedir + " to " + archetypeFilesDirectory);
for (FileSet fileSet : fileSets) {
DirectoryScanner scanner = new DirectoryScanner();
scanner.setBasedir(basedir);
scanner.setIncludes((String[]) concatenateToList(fileSet.getIncludes(), fileSet.getDirectory()).toArray(new String[fileSet.getIncludes().size()]));
scanner.setExcludes((String[]) addLists(fileSet.getExcludes(), excludePatterns).toArray(new String[fileSet.getExcludes().size()]));
scanner.addDefaultExcludes();
getLogger().debug("Using fileset " + fileSet);
scanner.scan();
List<String> fileSetResources = Arrays.asList(scanner.getIncludedFiles());
getLogger().debug("Scanned " + fileSetResources.size() + " resources");
if (fileSet.isFiltered()) {
processFileSet(basedir, archetypeFilesDirectory, fileSet.getDirectory(), fileSetResources, fileSet.isPackaged(), packageName, reverseProperties, defaultEncoding);
getLogger().debug("Processed " + fileSet.getDirectory() + " files");
} else {
copyFiles(basedir, archetypeFilesDirectory, fileSet.getDirectory(), fileSetResources, fileSet.isPackaged(), packageName, reverseProperties);
getLogger().debug("Copied " + fileSet.getDirectory() + " files");
}
}
}
Aggregations