use of org.apache.maven.shared.model.fileset.util.FileSetManager in project maven-dependency-plugin by apache.
the class DependencyTestUtils method removeDirectory.
/**
* Deletes a directory and its contents.
*
* @param dir {@link File} The base directory of the included and excluded files.
* @throws IOException in case of an error. 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.util.FileSetManager in project maven-scm by apache.
the class AbstractScmMojo method handleExcludesIncludesAfterCheckoutAndExport.
protected void handleExcludesIncludesAfterCheckoutAndExport(File checkoutDirectory) throws MojoExecutionException {
List<String> includes = new ArrayList<String>();
if (!StringUtils.isBlank(this.getIncludes())) {
String[] tokens = StringUtils.split(this.getIncludes(), ",");
for (int i = 0; i < tokens.length; ++i) {
includes.add(tokens[i]);
}
}
List<String> excludes = new ArrayList<String>();
if (!StringUtils.isBlank(this.getExcludes())) {
String[] tokens = StringUtils.split(this.getExcludes(), ",");
for (int i = 0; i < tokens.length; ++i) {
excludes.add(tokens[i]);
}
}
if (includes.isEmpty() && excludes.isEmpty()) {
return;
}
FileSetManager fileSetManager = new FileSetManager();
FileSet fileset = new FileSet();
fileset.setDirectory(checkoutDirectory.getAbsolutePath());
// revert the order to do the delete
fileset.setIncludes(excludes);
fileset.setExcludes(includes);
fileset.setUseDefaultExcludes(false);
try {
fileSetManager.delete(fileset);
} catch (IOException e) {
throw new MojoExecutionException("Error found while cleaning up output directory base on " + "excludes/includes configurations.", e);
}
}
use of org.apache.maven.shared.model.fileset.util.FileSetManager in project maven-plugins by apache.
the class DependencyTestUtils method removeDirectory.
/**
* Deletes a directory and its contents.
*
* @param dir {@link File} The base directory of the included and excluded files.
* @throws IOException in case of an error. 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.util.FileSetManager in project spf4j by zolyfarkas.
the class SchemaCompileMojo method getSourceFiles.
public String[] getSourceFiles(final String pattern) {
FileSetManager fsm = new FileSetManager();
FileSet fs = new FileSet();
fs.setDirectory(sourceDirectory.getAbsolutePath());
fs.addInclude(pattern);
fs.setFollowSymlinks(false);
return fsm.getIncludedFiles(fs);
}
use of org.apache.maven.shared.model.fileset.util.FileSetManager in project spf4j by zolyfarkas.
the class SchemaCompileMojo method getFiles.
public static String[] getFiles(final File directory, final String pattern) {
FileSetManager fsm = new FileSetManager();
FileSet fs = new FileSet();
fs.setDirectory(directory.getAbsolutePath());
fs.addInclude(pattern);
fs.setFollowSymlinks(false);
return fsm.getIncludedFiles(fs);
}
Aggregations