private static String[] scanForSources(final File sourceDir,final Set<String> sourceIncludes,final Set<String> sourceExcludes){
  final DirectoryScanner ds=new DirectoryScanner();
  ds.setFollowSymlinks(true);
  ds.setBasedir(sourceDir);
  ds.setIncludes(sourceIncludes.toArray(new String[sourceIncludes.size()]));
  ds.setExcludes(sourceExcludes.toArray(new String[sourceExcludes.size()]));
  ds.addDefaultExcludes();
  try {
    ds.scan();
  }
 catch (  IllegalStateException e) {
    return new String[0];
  }
  return ds.getIncludedFiles();
}

private static String [ ] scanForSources ( final File sourceDir , final Set < String > sourceIncludes , final Set < String > sourceExcludes ) { final DirectoryScanner ds = new DirectoryScanner ( ) ; ds . setFollowSymlinks ( true ) ; ds . setBasedir ( sourceDir ) ; ds . setIncludes ( sourceIncludes . toArray ( new String [ sourceIncludes . size ( ) ] ) ) ; ds . setExcludes ( sourceExcludes . toArray ( new String [ sourceExcludes . size ( ) ] ) ) ; ds . addDefaultExcludes ( ) ; try { ds . scan ( ) ; } catch ( IllegalStateException e ) { return new String [ 0 ] ; } return ds . getIncludedFiles ( ) ; }
scans a single source dir for sources and includes only the files whose name match the patterns in sourceincludes and excludes all files whose names match the patterns in sourceexcludes
