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


Java DirectoryScanner类代码示例

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


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

示例1: getSassDirectories

import org.codehaus.plexus.util.DirectoryScanner; //导入依赖的package包/类
private String[] getSassDirectories() {
    DirectoryScanner scanner = new DirectoryScanner();
    scanner.setBasedir(sassSourceDirectory);
    scanner.setIncludes(new String[]{"**/sass"});
    scanner.addDefaultExcludes();
    scanner.scan();
    return scanner.getIncludedDirectories();
}
 
开发者ID:learningobjectsinc,项目名称:sass-maven-plugin,代码行数:9,代码来源:CompileSassMojo.java

示例2: searchDir

import org.codehaus.plexus.util.DirectoryScanner; //导入依赖的package包/类
private Stream<File> searchDir(File dir, boolean warnOnBadDir) {
  if (dir == null || !dir.exists() || !dir.isDirectory()) {
    if (warnOnBadDir && dir != null) {
      getLog().warn("Directory does not exist or is not a directory: " + dir);
    }
    return Stream.empty();
  }
  getLog().debug("Adding directory " + dir);
  DirectoryScanner ds = new DirectoryScanner();
  ds.setBasedir(dir);
  ds.setIncludes(includes != null && includes.length > 0 ? includes : DEFAULT_INCLUDES);
  ds.setExcludes(excludes);
  ds.addDefaultExcludes();
  ds.setCaseSensitive(false);
  ds.setFollowSymlinks(false);
  ds.scan();
  return Stream.of(ds.getIncludedFiles()).map(filename -> new File(dir, filename)).parallel();
}
 
开发者ID:revelc,项目名称:impsort-maven-plugin,代码行数:19,代码来源:AbstractImpSortMojo.java

示例3: getFilesToCopy

import org.codehaus.plexus.util.DirectoryScanner; //导入依赖的package包/类
/**
 * Returns a list of filenames that should be copied over to the destination directory.
 *
 * @param resource the resource to be scanned
 * @return the array of filenames, relative to the sourceDir
 */
private String[] getFilesToCopy( Resource resource )
{
    // CHECKSTYLE_OFF: LineLength
    DirectoryScanner scanner = new DirectoryScanner();
    scanner.setBasedir( resource.getDirectory() );
    if ( resource.getIncludes() != null && !resource.getIncludes().isEmpty() )
    {
        scanner.setIncludes( (String[]) resource.getIncludes().toArray( new String[resource.getIncludes().size()] ) );
    }
    else
    {
        scanner.setIncludes( DEFAULT_INCLUDES );
    }
    if ( resource.getExcludes() != null && !resource.getExcludes().isEmpty() )
    {
        scanner.setExcludes( (String[]) resource.getExcludes().toArray( new String[resource.getExcludes().size()] ) );
    }

    scanner.addDefaultExcludes();

    scanner.scan();

    return scanner.getIncludedFiles();
    // CHECKSTYLE_ON: LineLength
}
 
开发者ID:zhegexiaohuozi,项目名称:maven-seimicrawler-plugin,代码行数:32,代码来源:WarProjectPackagingTask.java

示例4: scanDirectory

import org.codehaus.plexus.util.DirectoryScanner; //导入依赖的package包/类
private void scanDirectory(File directory, BufferedWriter writer) throws IOException {
    if (!directory.exists())
        return;

    final Log log = getLog();
    log.info("scanning source directory '" + directory.getAbsolutePath() + "'");

    DirectoryScanner scanner = new DirectoryScanner();
    scanner.setIncludes(includes);
    scanner.setExcludes(excludes);
    scanner.setBasedir(directory);
    scanner.scan();

    for (String fileName : scanner.getIncludedFiles()) {
        writer.write(fileName);
        writer.newLine();
    }
}
 
开发者ID:HostingAgency,项目名称:gwtcoverage-maven-plugin,代码行数:19,代码来源:SourcesListMojo.java

示例5: getDirectoryFileNames

import org.codehaus.plexus.util.DirectoryScanner; //导入依赖的package包/类
/**
 * Retrieves a list of file names that are in the given directory, possibly filtered by the list of include
 * patterns or exclude patterns
 *
 * @param baseDirectory directory to retrieve file names from
 * @param includes list of patterns to match against for file names to include, can include Ant patterns
 * @param excludes list of patterns to match for excluded file names, can include Ant patterns
 * @return list of file names within the directory that match all given patterns
 */
public static List<String> getDirectoryFileNames(File baseDirectory, String[] includes, String[] excludes) {
    List<String> files = new ArrayList<String>();

    DirectoryScanner scanner = new DirectoryScanner();

    if (includes != null) {
        scanner.setIncludes(includes);
    }

    if (excludes != null) {
        scanner.setExcludes(excludes);
    }

    scanner.setCaseSensitive(false);
    scanner.addDefaultExcludes();
    scanner.setBasedir(baseDirectory);

    scanner.scan();

    for (String includedFilename : scanner.getIncludedFiles()) {
        files.add(includedFilename);
    }

    return files;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:35,代码来源:ThemeBuilderUtils.java

示例6: getClasses

import org.codehaus.plexus.util.DirectoryScanner; //导入依赖的package包/类
@Override
public List<String> getClasses() {
    DirectoryScanner classScanner = new DirectoryScanner();
    String baseDir = getClassDir();
    List<String> ret = new ArrayList<>();

    if(!new File(baseDir).exists()) {
        return ret;
    }
    classScanner.setBasedir(baseDir);
    classScanner.setCaseSensitive(true);
    classScanner.setIncludes(new String[]{"**/*class"});
    classScanner.setExcludes(new String[]{"**/*$*.class"});
    classScanner.scan();

    for(String s: classScanner.getIncludedFiles()){
        ret.add(s.replaceAll("/", ".").replaceAll("\\\\", ".").replaceAll("\\.class",""));
    }
    return ret;
}
 
开发者ID:spideruci,项目名称:tacoco,代码行数:21,代码来源:GradleModule.java

示例7: getTestClasses

import org.codehaus.plexus.util.DirectoryScanner; //导入依赖的package包/类
@Override
public List<String> getTestClasses() {
    List<String> ret = new ArrayList<>();
    DirectoryScanner scanner = new DirectoryScanner();
    String baseDir = getTestclassDir();
    if(!new File(baseDir).exists()) {
        return ret;
    }
    scanner.setBasedir(baseDir);
    scanner.setCaseSensitive(true);
    scanner.scan();

    for(String s: scanner.getIncludedFiles()){
        ret.add(s.replaceAll("/", ".").replaceAll("\\\\", ".").replaceAll("\\.class",""));
    }
    return ret;
}
 
开发者ID:spideruci,项目名称:tacoco,代码行数:18,代码来源:GradleModule.java

示例8: getTestClasses

import org.codehaus.plexus.util.DirectoryScanner; //导入依赖的package包/类
@Override
public List<String> getTestClasses(){
	List<String> ret = new ArrayList<>();
	DirectoryScanner scanner = new DirectoryScanner();
	String baseDir = this.targetDir+"/target/classes";
	if(!new File(baseDir).exists()) {
		return ret;
	}
	makeFilter(scanner);
	final String testClassPath = new PathBuilder().path(targetDir).path("target").path("test-classes").buildFilePath(); //MAVEN TEST CLASS FOLDER
	if(!new File(testClassPath).exists()) {
		return ret;
	}
	scanner.setBasedir(testClassPath);
	scanner.setCaseSensitive(true);
	scanner.scan();

	for(String s: scanner.getIncludedFiles()){
		ret.add(s.replaceAll("/", ".").replaceAll("\\\\", ".").replaceAll("\\.class",""));
	}
	return ret;
	
}
 
开发者ID:spideruci,项目名称:tacoco,代码行数:24,代码来源:MavenModule.java

示例9: getClasses

import org.codehaus.plexus.util.DirectoryScanner; //导入依赖的package包/类
@Override
public List<String> getClasses(){
	DirectoryScanner classScanner = new DirectoryScanner();
	String baseDir = new PathBuilder().path(targetDir).path("target").path("classes").buildFilePath();
	List<String> ret = new ArrayList<>();
	
	if(!new File(baseDir).exists()) {
		return ret;
	}
	classScanner.setBasedir(baseDir);
	classScanner.setCaseSensitive(true);
	classScanner.setIncludes(new String[]{"**/*class"});
	classScanner.setExcludes(new String[]{"**/*$*.class"});
	classScanner.scan();
	
	for(String s: classScanner.getIncludedFiles()){
		ret.add(s.replaceAll("/", ".").replaceAll("\\\\", ".").replaceAll("\\.class",""));
	}
	return ret;
	
}
 
开发者ID:spideruci,项目名称:tacoco,代码行数:22,代码来源:MavenModule.java

示例10: copyResources

import org.codehaus.plexus.util.DirectoryScanner; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
public void copyResources( File sourceDirectory, File targetDirectory )
        throws MojoExecutionException
{
    if ( !sourceDirectory.exists() )
    {
        getLogger().info( "Directory does not exist " + sourceDirectory.getAbsolutePath() );
    }
    else
    {
        if ( !sourceDirectory.isDirectory() )
        {
            getLogger().debug( "Not a directory: " + sourceDirectory.getAbsolutePath() );
        }
        else
        {
            getLogger().debug( "Copying resources from " + sourceDirectory.getAbsolutePath() );

            // this may needs to be parametrized somehow
            String excludes = concat( DirectoryScanner.DEFAULTEXCLUDES, ", " );
            copyDirectoryStructure( sourceDirectory, targetDirectory, "**", excludes );
        }

    }
}
 
开发者ID:mojohaus,项目名称:webstart,代码行数:28,代码来源:DefaultIOUtil.java

示例11: scan

import org.codehaus.plexus.util.DirectoryScanner; //导入依赖的package包/类
/**
 * Scans a single directory
 *
 * @param root Directory to scan
 * @param includes
 * @param excludes
 * @return
 */
public static List<File> scan(File root, String[] includes, String[] excludes) {
	List<File> files = new ArrayList<File>();
	if (!root.exists()) {
		return files;
	}

	final DirectoryScanner directoryScanner = new DirectoryScanner();
	directoryScanner.setIncludes(includes);
	directoryScanner.setExcludes(excludes);
	directoryScanner.setBasedir(root);
	directoryScanner.scan();

	for (final String fileName : directoryScanner.getIncludedFiles()) {
		files.add(new File(root, fileName));
	}

	return files;
}
 
开发者ID:EvoSuite,项目名称:evosuite,代码行数:27,代码来源:FileUtils.java

示例12: scanForJavaFiles

import org.codehaus.plexus.util.DirectoryScanner; //导入依赖的package包/类
private void scanForJavaFiles(List<SourceFile> sources, File sourceDirectory) {
	if (!sourceDirectory.exists()) {
		getLog().debug(sourceDirectory.getAbsolutePath() + " is declared but doesn't exist");
		return;
	}

	DirectoryScanner dirScanner = new DirectoryScanner();
	dirScanner.setBasedir(sourceDirectory);
	dirScanner.setIncludes(includes);
	dirScanner.setExcludes(excludes);
	dirScanner.scan();

	for (String includedPath : dirScanner.getIncludedFiles()) {
		if (includedPath.endsWith(".java")) {
			sources.add(new SourceFile(new File(sourceDirectory, includedPath)));
		}
	}
}
 
开发者ID:lgrignon,项目名称:jsweet-maven-plugin,代码行数:19,代码来源:AbstractJSweetMojo.java

示例13: copyContent

import org.codehaus.plexus.util.DirectoryScanner; //导入依赖的package包/类
public static void copyContent( Path basePath, Path destPath, List<String> includes, List<String> excludes,
                                boolean filtering, Function<String, Object> mapper ) {
    DirectoryScanner scanner = new DirectoryScanner();
    scanner.setBasedir( basePath.toFile() );
    scanner.setIncludes( includes.toArray( new String[includes.size()] ) );
    scanner.setExcludes( excludes.toArray( new String[excludes.size()] ) );
    scanner.scan();
    for( String included : scanner.getIncludedFiles() ) {
        Path src = basePath.resolve( included );
        Path dst = destPath.resolve( included );
        if( filtering ) Files.writeString( dst, Strings.substitute( Files.readString( src ), mapper ) );
        else copy( src, Encoding.PLAIN, dst, Encoding.PLAIN );

        if( !Resources.IS_WINDOWS )
            setPosixPermissions( dst, getPosixPermissions( src ) );
    }
}
 
开发者ID:oaplatform,项目名称:oap,代码行数:18,代码来源:Files.java

示例14: createArchive

import org.codehaus.plexus.util.DirectoryScanner; //导入依赖的package包/类
private void createArchive(File installerFile) throws JbiPluginException {
    try {
        getLog().info("Generating service assembly " + installerFile.getAbsolutePath());
        MavenArchiver archiver = new MavenArchiver();
        archiver.setArchiver(jarArchiver);
        archiver.setOutputFile(installerFile);
        Manifest m = createManifest();
        String version = getProject().getArtifact().getVersion();
        // add Implementation-Version attribute in the MANIFEST
        m.getMainSection().addConfiguredAttribute(new Manifest.Attribute("Implementation-Version", version));

        getLog().info("Add Implementation-Version: " + version);

        jarArchiver.addConfiguredManifest(m);

        File classesDir = new File(getProject().getBuild().getOutputDirectory());
        if ( classesDir.exists() )
            jarArchiver.addDirectory(classesDir, null, DirectoryScanner.DEFAULTEXCLUDES);

        jarArchiver.addDirectory(workDirectory, null, DirectoryScanner.DEFAULTEXCLUDES);
        archiver.createArchive(getProject(), archive);
    } catch (Exception e) {
        throw new JbiPluginException("Error creating shared library: "
                + e.getMessage(), e);
    }
}
 
开发者ID:hitakaken,项目名称:bigfoot-maven-plugins,代码行数:27,代码来源:GenerateServiceAssemblyMojo.java

示例15: createArchive

import org.codehaus.plexus.util.DirectoryScanner; //导入依赖的package包/类
private void createArchive(File installerFile) throws JbiPluginException {
    try {

        // generate war file
        getLog().info(
                "Generating shared library "
                        + installerFile.getAbsolutePath());
        MavenArchiver archiver = new MavenArchiver();
        archiver.setArchiver(jarArchiver);
        archiver.setOutputFile(installerFile);
        jarArchiver.addDirectory(workDirectory);
        jarArchiver.addConfiguredManifest(createManifest());
        if (jbiSourceDirectory.isDirectory()) {
            jarArchiver.addDirectory(jbiSourceDirectory, null,
                    DirectoryScanner.DEFAULTEXCLUDES);
        }
        // create archive
        archiver.createArchive(getProject(), archive);

    } catch (Exception e) {
        throw new JbiPluginException("Error creating shared library: "
                + e.getMessage(), e);
    }
}
 
开发者ID:hitakaken,项目名称:bigfoot-maven-plugins,代码行数:25,代码来源:GenerateSharedLibraryMojo.java


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