Java Code Examples for org.codehaus.plexus.util.FileUtils#getFiles()

The following examples show how to use org.codehaus.plexus.util.FileUtils#getFiles() . 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: ReportGenerator.java    From buck with Apache License 2.0 6 votes vote down vote up
private IBundleCoverage analyzeStructure() throws IOException {
  CoverageBuilder coverageBuilder = new CoverageBuilder();
  Analyzer analyzer = new Analyzer(execFileLoader.getExecutionDataStore(), coverageBuilder);

  String[] classesDirs = classesPath.split(":");
  for (String classesDir : classesDirs) {
    File classesDirFile = new File(classesDir);
    if (classesDirFile.exists()) {
      for (File clazz : FileUtils.getFiles(classesDirFile, coverageIncludes, coverageExcludes)) {
        analyzer.analyzeAll(clazz);
      }
    }
  }

  return coverageBuilder.getBundle(title);
}
 
Example 2
Source File: JnlpReportMojo.java    From webstart with MIT License 5 votes vote down vote up
private void copyJnlpFiles()
        throws MavenReportException
{
    if ( !jnlpSourceDirectory.exists() )
    {
        throw new MavenReportException( "jnlpSourceDirectory does not exist" );
    }
    try
    {
        File destinationDirectory = new File( outputDirectory, siteJnlpDirectory );
        List<File> files = FileUtils.getFiles( jnlpSourceDirectory, "**/*", "" );
        for ( File file : files )
        {
            getLog().debug( "Copying " + file + " to " + destinationDirectory );
            String path = file.getAbsolutePath().substring( jnlpSourceDirectory.getAbsolutePath().length() + 1 );
            File destDir = new File( destinationDirectory, path );
            getLog().debug( "Copying " + file + " to " + destDir );
            if ( file.isDirectory() )
            {
                destDir.mkdirs();
            }
            else
            {
                FileUtils.copyFileToDirectory( file, destDir.getParentFile() );
            }
        }
    }
    catch ( IOException e )
    {
        throw new MavenReportException( "Failed to copy jnlp files", e );
    }
}
 
Example 3
Source File: AbstractPitAggregationReportMojo.java    From pitest with Apache License 2.0 5 votes vote down vote up
private List<File> getProjectFilesByFilter(final File projectBaseDir,
                                           final String filter) throws IOException {

  File reportsDir = projectBaseDir.toPath().resolve(REPORT_DIR_RELATIVE_TO_PROJECT).toFile();
  if (!reportsDir.exists()) {
    return new ArrayList<>();
  }

  File latestReportDir = reportSourceLocator.locate(reportsDir, getLog());

  final List<File> files = FileUtils.getFiles(latestReportDir, filter, "");
  return files == null ? new ArrayList<>() : files;
}
 
Example 4
Source File: FileSetUtils.java    From hadoop with Apache License 2.0 3 votes vote down vote up
/**
 * Converts a Maven FileSet to a list of File objects.
 * 
 * @param source FileSet to convert
 * @return List containing every element of the FileSet as a File
 * @throws IOException if an I/O error occurs while trying to find the files
 */
@SuppressWarnings("unchecked")
public static List<File> convertFileSetToFiles(FileSet source) throws IOException {
  String includes = getCommaSeparatedList(source.getIncludes());
  String excludes = getCommaSeparatedList(source.getExcludes());
  return FileUtils.getFiles(new File(source.getDirectory()), includes, excludes);
}
 
Example 5
Source File: FileSetUtils.java    From big-c with Apache License 2.0 3 votes vote down vote up
/**
 * Converts a Maven FileSet to a list of File objects.
 * 
 * @param source FileSet to convert
 * @return List containing every element of the FileSet as a File
 * @throws IOException if an I/O error occurs while trying to find the files
 */
@SuppressWarnings("unchecked")
public static List<File> convertFileSetToFiles(FileSet source) throws IOException {
  String includes = getCommaSeparatedList(source.getIncludes());
  String excludes = getCommaSeparatedList(source.getExcludes());
  return FileUtils.getFiles(new File(source.getDirectory()), includes, excludes);
}
 
Example 6
Source File: FileSetUtils.java    From tajo with Apache License 2.0 3 votes vote down vote up
/**
 * Converts a Maven FileSet to a list of File objects.
 * 
 * @param source FileSet to convert
 * @return List<File> containing every element of the FileSet as a File
 * @throws IOException if an I/O error occurs while trying to find the files
 */
@SuppressWarnings("unchecked")
public static List<File> convertFileSetToFiles(FileSet source) throws IOException {
  String includes = getCommaSeparatedList(source.getIncludes());
  String excludes = getCommaSeparatedList(source.getExcludes());
  return FileUtils.getFiles(new File(source.getDirectory()), includes, excludes);
}