private String[] findArtifacts(String path) throws MojoExecutionException
{
DirectoryScanner scanner = new DirectoryScanner();
FileSet fileSet = new FileSet();
fileSet.setDirectory(path);
if (policy.toLowerCase().equals("snapshot"))
{
prepareInclusionSet(fileSet);
// fileSet.addInclude(SNAPSHOT_JARS);
// fileSet.addInclude(SNAPSHOT_WARS);
prepareExclusionSet(fileSet);
}
else
{
prepareInclusionSet(fileSet);
prepareExclusionSet(fileSet);
fileSet.addExclude(SNAPSHOT_JARS);
fileSet.addExclude(SNAPSHOT_WARS);
}
// Include default artifact types:
// fileSet.addInclude(INCLUDES_JARS);
// fileSet.addInclude(INCLUDES_WARS);
File resourceDirectory = new File(fileSet.getDirectory());
String[] finalIncludes = new String[fileSet.getIncludes().size()];
String[] finalExcludes = new String[fileSet.getExcludes().size()];
finalIncludes = fileSet.getIncludes().toArray(finalIncludes);
finalExcludes = fileSet.getExcludes().toArray(finalExcludes);
System.out.println("Includes: " + Arrays.toString(finalIncludes));
System.out.println("Excludes: " + Arrays.toString(finalExcludes));
scanner.setBasedir(resourceDirectory);
scanner.setIncludes(finalIncludes);
if (fileSet.getExcludes() != null && !fileSet.getExcludes().isEmpty())
scanner.setExcludes(finalExcludes);
scanner.addDefaultExcludes();
scanner.scan();