org.apache.tools.ant.types.selectors.FilenameSelector Java Examples

The following examples show how to use org.apache.tools.ant.types.selectors.FilenameSelector. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PathFileSetTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Test
public void testFileNameSelector() throws IOException {
    FilenameSelector sel = new FilenameSelector();
    sel.setCasesensitive(false);
    sel.setName("**/config/**/*.xml");
    pfs.add(sel);
    executeAndCheckResults(new String[]{"cl1/config/Modules/org-m1.xml"});
}
 
Example #2
Source File: PlayConfigurationLoadTask.java    From restcommander with Apache License 2.0 5 votes vote down vote up
public void execute() {
    if (applicationDir == null) {
        throw new BuildException("No applicationDir set!");
    }

    // Add the properties from application.conf as ant properties
    for (Map.Entry<String,String> entry: properties().entrySet()) {
        String key = entry.getKey();
        String value = project.replaceProperties(entry.getValue());
        project.setProperty(prefix + key, value);
        project.log("Loaded property '" + prefix + key + "'='" + value + "'", Project.MSG_VERBOSE);
    }

    // Add the module classpath as an ant property
    Path path = new Path(project);
    FilenameSelector endsToJar = new FilenameSelector();
    endsToJar.setName("*.jar");

    for (File module: modules()) {
        File moduleLib = new File(module, "lib");
        if (moduleLib.exists()) {
            FileSet fileSet = new FileSet();
            fileSet.setDir(moduleLib);
            fileSet.addFilename(endsToJar);
            path.addFileset(fileSet);
            project.log("Added fileSet to path: " + fileSet, Project.MSG_VERBOSE);
        } else {
            project.log("Ignoring non existing lib dir: " + moduleLib.getAbsolutePath(), Project.MSG_VERBOSE);
        }
    }
    project.addReference(modulesClasspath, path);
    project.log("Generated classpath '" + modulesClasspath + "':" + project.getReference(modulesClasspath), Project.MSG_VERBOSE);
}
 
Example #3
Source File: PathFileSet.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public void addFilename(FilenameSelector selector) {
    selectors.addFilename(selector);
}