当前位置: 首页>>代码示例>>Java>>正文


Java FileUtils.getFiles方法代码示例

本文整理汇总了Java中org.codehaus.plexus.util.FileUtils.getFiles方法的典型用法代码示例。如果您正苦于以下问题:Java FileUtils.getFiles方法的具体用法?Java FileUtils.getFiles怎么用?Java FileUtils.getFiles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.codehaus.plexus.util.FileUtils的用法示例。


在下文中一共展示了FileUtils.getFiles方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: execute

import org.codehaus.plexus.util.FileUtils; //导入方法依赖的package包/类
/**
 * Called by the project to let the task do its work.
 * This will invoke PatternGenerator for each file in the nested FileSet(s).
 *
 * @throws MojoExecutionException if something goes wrong.
 */
public void execute() throws MojoExecutionException {
    PatternGenerator pg = null;
    try {
        File directory = new File(fileSet.getDirectory());
        String includes = StringUtils.join(fileSet.getIncludes(), ",");
        String excludes = StringUtils.join(fileSet.getExcludes(), ",");
        List<File> fileList = FileUtils.getFiles(directory, includes, excludes);
        for (File file : fileList) {
            pg = new PatternGenerator(file.toURI().toURL());
            pg.setData(fileList);
            pg.processPattern();
            pg.destroy();
            pg = null;
        }
    } catch (Exception e) {
        e.printStackTrace();
        throw new MojoExecutionException("Error in executing PatternGeneratorMojo: " + e.getMessage(), e);
    } finally {
        if (pg != null) {
            pg.destroy();
        }
    }
}
 
开发者ID:jaffa-projects,项目名称:jaffa-framework,代码行数:30,代码来源:PatternGeneratorMojo.java

示例2: toFileList

import org.codehaus.plexus.util.FileUtils; //导入方法依赖的package包/类
public List<File> toFileList( FileSet fs ) throws MojoExecutionException
{
    try
    {
        if ( fs.getDirectory() != null )
        {
            File directory = new File( fs.getDirectory() );
            String includes = toString( fs.getIncludes() );
            String excludes = toString( fs.getExcludes() );
            return FileUtils.getFiles( directory, includes, excludes );
        }
        else
        {
            getLog().warn( String.format( "Fileset [%s] directory empty", fs.toString() ) );
            return new ArrayList<>();
        }
    }
    catch ( IOException e )
    {
        throw new MojoExecutionException( String.format( "Unable to get paths to fileset [%s]", fs.toString() ),
                e );
    }
}
 
开发者ID:cjnygard,项目名称:rest-maven-plugin,代码行数:24,代码来源:Plugin.java

示例3: getTargetPropertiesFiles

import org.codehaus.plexus.util.FileUtils; //导入方法依赖的package包/类
/**
 * gets a list of all property files in the iib and iib-test directories. A copy of the default
 * properties file will be copied into the iib-overrides directory if both iib directories are empty.
 * 
 * @return
 * @throws MojoFailureException
 */
@SuppressWarnings("unchecked")
private List<File> getTargetPropertiesFiles() throws MojoFailureException {
    List<File> propFiles = null;

    File targetIibDirectory = new File(project.getBuild().getDirectory(), "iib-overrides");

    try {
        // see also PrepareIibBarPackagingMojo.java
        // String excludedDefaultPropertyFileName = defaultPropertiesFile.getName();

        propFiles = FileUtils.getFiles(targetIibDirectory, "*.properties", null);// excludedDefaultPropertyFileName);


    } catch (IOException e) {
        // TODO handle exception
        throw new MojoFailureException("Error searching for properties files under " + targetIibDirectory, e);
    }

    return propFiles;
}
 
开发者ID:bretthshelley,项目名称:Maven-IIB9-Plug-In,代码行数:28,代码来源:ApplyBarOverridesMojo.java

示例4: findPropertiesForPatterns

import org.codehaus.plexus.util.FileUtils; //导入方法依赖的package包/类
private Set<File> findPropertiesForPatterns(final File basedir, final List<String> patterns) throws IOException {
    final Set<File> propertiesFiles = new TreeSet<File>();
    for (final String pattern : patterns) {

        @SuppressWarnings("unchecked")
        final List<File> files = FileUtils.getFiles(basedir, pattern, null);
        propertiesFiles.addAll(files);

    }
    return propertiesFiles;
}
 
开发者ID:thrawn-sh,项目名称:properties-validate,代码行数:12,代码来源:PropertiesInfoPlugin.java

示例5: toFileList

import org.codehaus.plexus.util.FileUtils; //导入方法依赖的package包/类
private static List<File> toFileList(FileSet fileSet)
           throws IOException {

       File directory = new File(fileSet.getDirectory());
if (directory.exists()) {
    String includes = toString(fileSet.getIncludes());
    String excludes = toString(fileSet.getExcludes());
    return FileUtils.getFiles(directory, includes, excludes);
}
return Collections.<File>emptyList();
   }
 
开发者ID:creditkarma,项目名称:maven-exec-jar-plugin,代码行数:12,代码来源:ExecJarMojo.java

示例6: getTmlFiles

import org.codehaus.plexus.util.FileUtils; //导入方法依赖的package包/类
private Set<String> getTmlFiles() throws IOException {
	Set<String> files = new HashSet<>();
	for (FileSet fileSet : tmls) {
		File directory = (fileSet.getDirectory() == null) ? 
				this.project.getBasedir() : new File(fileSet.getDirectory());
		String includes = StringUtils.join(fileSet.getIncludes(), ',');
           String excludes = StringUtils.join(fileSet.getExcludes(), ',');
           for (File file : FileUtils.getFiles(directory, includes, excludes)) {
           	files.add(file.getAbsolutePath());
           }
	}
	return files;
}
 
开发者ID:ExpediaDotCom,项目名称:tesla,代码行数:14,代码来源:CompileMojo.java

示例7: getFiles

import org.codehaus.plexus.util.FileUtils; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private List<File> getFiles() throws IOException {
	final String includesString = (getIncludes() == null || getIncludes().length == 0) ? "**/*.java"
			: StringUtils.join(getIncludes(), ",");
	final String excludesString = (getExcludes() == null || getExcludes().length == 0) ? null
			: StringUtils.join(getExcludes(), ",");

	return FileUtils.getFiles(getSourceDirectory(), includesString, excludesString);
}
 
开发者ID:muh6mm3d,项目名称:jannocessor,代码行数:10,代码来源:AbstractJAnnocessorMojo.java

示例8: cqlFiles

import org.codehaus.plexus.util.FileUtils; //导入方法依赖的package包/类
public static List<File> cqlFiles(FileSet fileSet) throws IOException {
    File directory = new File(fileSet.getDirectory());
    String includes = fileSet.getIncludes().stream().collect(joining(", "));
    String excludes = fileSet.getExcludes().stream().collect(joining(", "));

    @SuppressWarnings("unchecked")
    List<File> files = FileUtils.getFiles(directory, includes, excludes);

    Collections.sort(files);
    return files;
}
 
开发者ID:bric3,项目名称:cql-maven-plugin,代码行数:12,代码来源:CqlExecuteMojo.java

示例9: getAllFiles

import org.codehaus.plexus.util.FileUtils; //导入方法依赖的package包/类
public Set<File> getAllFiles(String includes, String excludes, boolean includeResources) throws IOException
{
	Set<File> sourceDirs = new HashSet<File>();
	final java.util.List<String> sourceRoots = getProject().getCompileSourceRoots();
	if (sourceRoots != null)
	{
		for (String s : sourceRoots)
		{
			sourceDirs.add(new File(s));
		}
	}
	
	if(includeResources)
	{
		List<Resource> resources = getProject().getResources();
		if (resources != null)
		{
			for (Resource resource : resources)
			{
				sourceDirs.add(new File(resource.getDirectory()));
			}
		}
	}

	Set<File> files = new HashSet<File>();
	for (File sourceRoot : sourceDirs)
	{
		if (getLog().isDebugEnabled())
		{
			getLog().debug("Scanning source folder: " + sourceRoot.getCanonicalPath());
		}
		@SuppressWarnings("unchecked")
		List<File> dirFiles = FileUtils.getFiles(sourceRoot, includes, excludes);
		if (dirFiles != null)
		{
			files.addAll(dirFiles);
		}
	}
	return files;
}
 
开发者ID:CruxFramework,项目名称:crux-maven-plugin,代码行数:41,代码来源:AbstractToolMojo.java

示例10: copyJnlpFiles

import org.codehaus.plexus.util.FileUtils; //导入方法依赖的package包/类
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 );
    }
}
 
开发者ID:mojohaus,项目名称:webstart,代码行数:33,代码来源:JnlpReportMojo.java

示例11: existsCoverageTest

import org.codehaus.plexus.util.FileUtils; //导入方法依赖的package包/类
private boolean existsCoverageTest() throws IOException {
    final File testDir = new File(mavenProject.getBuild().getTestOutputDirectory());
    final List<File> testFiles = FileUtils.getFiles(testDir, "**/" + testClass + ".class", "");
    if (testFiles.isEmpty()) {
        getLog().warn("Code coverage test not found: '" + testClass + ".java'.");
        return false;
    }
    return true;
}
 
开发者ID:nidi3,项目名称:code-assert,代码行数:10,代码来源:AssertMojo.java

示例12: addModelPullerScanner

import org.codehaus.plexus.util.FileUtils; //导入方法依赖的package包/类
/**
 * Adds a scanner if a "META-INF/switchyard.xml" file is found in the folder specified by baseDir.
 * 
 * @param baseDir the directory to search.
 * @param includes file includes.
 * @param excludes file excludes.
 * @param scanners the scanners list
 * @throws IOException if an error occurs.
 */
private void addModelPullerScanner(final File baseDir, final String includes, final String excludes, final List<Scanner<M>> scanners) throws IOException {
    final File switchYardFile = new File(baseDir, DEFAULT_SWITCHYARD_XML_FILE_PATH).getCanonicalFile();
    for (File file : (List<File>)FileUtils.getFiles(baseDir, includes, excludes)) {
        file = file.getCanonicalFile();
        if (switchYardFile.equals(file)) {
            // found a match, add a scanner
            scanners.add(new ModelPullerScanner<M>(file) {
                @Override
                public ScannerOutput<M> scan(ScannerInput<M> input) throws IOException {
                    ScannerOutput<M> output = super.scan(input);
                    M model = output.getModel();
                    if (model != null) {
                        Model root = model.getModelRoot();
                        if (root instanceof SwitchYardModel) {
                            if (!input.isSwitchyardNamespaceSet()) {
                                String uri = root.getModelRootNamespace();
                                SwitchYardNamespace ns = SwitchYardNamespace.fromUri(uri);
                                input.setSwitchyardNamespace(ns);
                            }
                        }
                    }
                    return output;
                }
            });
            // one file per folder
            return;
        }
    }
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:39,代码来源:ConfigureMojo.java

示例13: setUp

import org.codehaus.plexus.util.FileUtils; //导入方法依赖的package包/类
@Before
@Override
public void setUp()
    throws Exception
{
    super.setUp();

    File sourceRepoDir = new File( "./src/test/repositories/default-repository" );
    repoDir = new File( "./target/default-repository" );

    FileUtils.deleteDirectory( repoDir );
    assertFalse( "Default Test Repository should not exist.", repoDir.exists() );

    repoDir.mkdir();

    FileUtils.copyDirectoryStructure( sourceRepoDir, repoDir );
    // set the timestamps to a time well in the past
    Calendar cal = Calendar.getInstance();
    cal.add( Calendar.YEAR, -1 );
    for ( File f : (List<File>) FileUtils.getFiles( repoDir, "**", null ) )
    {
        f.setLastModified( cal.getTimeInMillis() );
    }
    // TODO: test they are excluded instead
    for ( String dir : (List<String>) FileUtils.getDirectoryNames( repoDir, "**/.svn", null, false ) )
    {
        FileUtils.deleteDirectory( new File( repoDir, dir ) );
    }

    assertTrue( "Default Test Repository should exist.", repoDir.exists() && repoDir.isDirectory() );

    assertNotNull( archivaConfig );

    // Create it
    ManagedRepositoryConfiguration repositoryConfiguration = new ManagedRepositoryConfiguration();
    repositoryConfiguration.setId( TEST_REPO_ID );
    repositoryConfiguration.setName( "Test Repository" );
    repositoryConfiguration.setLocation( repoDir.getAbsolutePath() );
    archivaConfig.getConfiguration().getManagedRepositories().clear();
    archivaConfig.getConfiguration().addManagedRepository( repositoryConfiguration );

    metadataRepository = mock( MetadataRepository.class );

    factory.setRepository( metadataRepository );
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:46,代码来源:ArchivaRepositoryScanningTaskExecutorAbstractTest.java

示例14: attemptToDelete

import org.codehaus.plexus.util.FileUtils; //导入方法依赖的package包/类
private void attemptToDelete(String expression)
{


    try
    {
        boolean isExpression = expression.indexOf("*") != -1;
        if (isExpression)
        {
            @SuppressWarnings("unchecked")
            List<File> files = FileUtils.getFiles(project.getBasedir(), expression, null, false);
            for (File file : files)
            {
                file.delete();
            }
            return;
        }


        // / try to delete absolute name
        boolean result = delete(expression);
        if (result == true) {
            return;
        }

        // / attempt to append path to project base directory
        File baseDir = project.getBasedir();
        String newPath = baseDir + File.separator + expression;
        // newPath = newPath.replaceAll(File.separator + File.separator, File.separator);
        result = delete(newPath);
        if (result == true) {
            return;
        }

        // / attempt to append path to workspace directory
        newPath = workspace.getAbsolutePath() + File.separator + expression;
        // newPath = newPath.replaceAll(File.separator + File.separator, File.separator);
        result = delete(newPath);
        if (result == true) {
            return;
        }

    } catch (Exception e)
    {
        getLog().info("unable to delete file " + expression + " for following reason: " + e);
    }

}
 
开发者ID:bretthshelley,项目名称:Maven-IIB9-Plug-In,代码行数:49,代码来源:InitializeBarBuildWorkspaceMojo.java

示例15: toFileList

import org.codehaus.plexus.util.FileUtils; //导入方法依赖的package包/类
public static List<File> toFileList(FileSet fileSet) throws IOException {
    File directory = new File(fileSet.getDirectory());
    String includes = toCommaSeparatedString(fileSet.getIncludes());
    String excludes = toCommaSeparatedString(fileSet.getExcludes());
    return FileUtils.getFiles(directory, includes, excludes);
}
 
开发者ID:fastconnect,项目名称:tibco-bwmaven,代码行数:7,代码来源:AbstractProjectsListMojo.java


注:本文中的org.codehaus.plexus.util.FileUtils.getFiles方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。