use of org.apache.maven.shared.model.fileset.FileSet in project jangaroo-tools by CoreMedia.
the class PropertiesMojo method execute.
public void execute() throws MojoExecutionException, MojoFailureException {
if (!generatedSourcesDirectory.exists()) {
getLog().info("generating sources into: " + generatedSourcesDirectory.getPath());
getLog().debug("created " + generatedSourcesDirectory.mkdirs());
}
if (properties == null) {
properties = new FileSet();
properties.setDirectory(resourceDirectory.getAbsolutePath());
properties.addInclude("**/*.properties");
}
FileLocations config = new FileLocations();
config.setOutputDirectory(generatedSourcesDirectory);
for (String srcFileRelativePath : new FileSetManager().getIncludedFiles(properties)) {
config.addSourceFile(new File(resourceDirectory, srcFileRelativePath));
}
try {
config.setSourcePath(Arrays.asList(resourceDirectory));
} catch (IOException e) {
throw new MojoExecutionException("configuration failure", e);
}
PropertyClassGenerator generator = new PropertyClassGenerator(config);
try {
generator.generate();
} catch (PropcException e) {
throw new MojoExecutionException("Generation failure", e);
}
}
use of org.apache.maven.shared.model.fileset.FileSet in project maven-plugins by apache.
the class DependencyTestUtils method removeDirectory.
/**
* Deletes a directory and its contents.
*
* @param dir
* The base directory of the included and excluded files.
*
* @throws IOException
* @throws MojoExecutionException
* When a directory failed to get deleted.
*/
public static void removeDirectory(File dir) throws IOException {
if (dir != null) {
Log log = new SilentLog();
FileSetManager fileSetManager = new FileSetManager(log, false);
FileSet fs = new FileSet();
fs.setDirectory(dir.getPath());
fs.addInclude("**/**");
fileSetManager.delete(fs);
}
}
use of org.apache.maven.shared.model.fileset.FileSet in project maven-plugins by apache.
the class AbstractCheckDocumentationMojo method findFiles.
protected boolean findFiles(File siteDirectory, String pattern) {
FileSet fs = new FileSet();
fs.setDirectory(siteDirectory.getAbsolutePath());
fs.setFollowSymlinks(false);
fs.addInclude("apt/" + pattern + ".apt");
fs.addInclude("apt/" + pattern + ".apt.vm");
fs.addInclude("xdoc/" + pattern + ".xml");
fs.addInclude("xdoc/" + pattern + ".xml.vm");
fs.addInclude("fml/" + pattern + ".fml");
fs.addInclude("fml/" + pattern + ".fml.vm");
fs.addInclude("resources/" + pattern + ".html");
fs.addInclude("resources/" + pattern + ".html.vm");
String[] includedFiles = fileSetManager.getIncludedFiles(fs);
return includedFiles != null && includedFiles.length > 0;
}
Aggregations