Search in sources :

Example 1 with FileSet

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);
    }
}
Also used : FileSet(org.apache.maven.shared.model.fileset.FileSet) MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) PropertyClassGenerator(net.jangaroo.properties.PropertyClassGenerator) PropcException(net.jangaroo.properties.api.PropcException) IOException(java.io.IOException) File(java.io.File) FileLocations(net.jangaroo.utils.FileLocations) FileSetManager(org.apache.maven.shared.model.fileset.util.FileSetManager)

Example 2 with FileSet

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);
    }
}
Also used : FileSet(org.apache.maven.shared.model.fileset.FileSet) Log(org.apache.maven.plugin.logging.Log) SilentLog(org.apache.maven.plugin.testing.SilentLog) SilentLog(org.apache.maven.plugin.testing.SilentLog) FileSetManager(org.apache.maven.shared.model.fileset.util.FileSetManager)

Example 3 with FileSet

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;
}
Also used : FileSet(org.apache.maven.shared.model.fileset.FileSet)

Aggregations

FileSet (org.apache.maven.shared.model.fileset.FileSet)3 FileSetManager (org.apache.maven.shared.model.fileset.util.FileSetManager)2 File (java.io.File)1 IOException (java.io.IOException)1 PropertyClassGenerator (net.jangaroo.properties.PropertyClassGenerator)1 PropcException (net.jangaroo.properties.api.PropcException)1 FileLocations (net.jangaroo.utils.FileLocations)1 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)1 Log (org.apache.maven.plugin.logging.Log)1 SilentLog (org.apache.maven.plugin.testing.SilentLog)1