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


Java FileSet.getDirectory方法代码示例

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


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

示例1: toFileList

import org.apache.maven.model.FileSet; //导入方法依赖的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

示例2: getFilesToProcess

import org.apache.maven.model.FileSet; //导入方法依赖的package包/类
protected List<File> getFilesToProcess() throws MojoExecutionException
{
    List<File> files = new ArrayList<>();
    if ( null != getFileset() )
    {
        if ( null == getFilesets() )
        {
            filesets = new ArrayList<>();
        }
        getFilesets().add( getFileset() );

    }
    if ( null != getFilesets() )
    {
        for ( FileSet fs : getFilesets() )
        {
            if ( (null != fs) && (null != fs.getDirectory()) )
            {
                FileSetTransformer fileMgr = new FileSetTransformer( fs );
                files.addAll( fileMgr.toFileList() );
            }
        }
    }
    return files;
}
 
开发者ID:cjnygard,项目名称:rest-maven-plugin,代码行数:26,代码来源:Plugin.java

示例3: toFileList

import org.apache.maven.model.FileSet; //导入方法依赖的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

示例4: getTmlFiles

import org.apache.maven.model.FileSet; //导入方法依赖的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

示例5: scan

import org.apache.maven.model.FileSet; //导入方法依赖的package包/类
/**
 * A {@link DirectoryScanner} boiler plate.
 *
 * @param fileSet {@link FileSet} to scan
 * @return the included paths
 */
private String[] scan( FileSet fileSet )
{
    File basedir = new File( fileSet.getDirectory() );
    if ( !basedir.exists() || !basedir.isDirectory() )
    {
        return null;
    }

    DirectoryScanner scanner = new DirectoryScanner();

    List<String> includes = fileSet.getIncludes();
    List<String> excludes = fileSet.getExcludes();

    if ( includes != null && includes.size() > 0 )
    {
        scanner.setIncludes( includes.toArray( new String[0] ) );
    }

    if ( excludes != null && excludes.size() > 0 )
    {
        scanner.setExcludes( excludes.toArray( new String[0] ) );
    }

    scanner.setBasedir( basedir );

    scanner.scan();
    return scanner.getIncludedFiles();
}
 
开发者ID:mojohaus,项目名称:xml-maven-plugin,代码行数:35,代码来源:CheckFormatMojo.java

示例6: cqlFiles

import org.apache.maven.model.FileSet; //导入方法依赖的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

示例7: execute

import org.apache.maven.model.FileSet; //导入方法依赖的package包/类
/**
 * Performs the conversion.
 *
 * @throws MojoExecutionException
 *             thrown when there is a problem executing Mjo.
 */
@Override
public void execute() throws MojoExecutionException {

    destDir.mkdirs();
    if (fontFileSets == null) {
        final FileSet defaultFontFileSet = new FileSet();
        defaultFontFileSet.setDirectory(new File(project.getBasedir(), "src/main/ttf").getPath());
        defaultFontFileSet.addInclude("**/*.ttf");
        fontFileSets = Collections.singletonList(defaultFontFileSet);
    }
    for (final FileSet fileSet : fontFileSets) {
        final String directory = fileSet.getDirectory();
        final File baseDirectory = new File(directory); // NOPMD
        if (!baseDirectory.isDirectory()) { // NOPMD
            getLog().warn(format(R.getString("missingdir"), directory));
            continue;
        }
        final Scanner scanner = buildContext.newScanner(baseDirectory);
        scanner.setIncludes(fileSet.getIncludes().toArray(new String[0])); // NOPMD
        scanner.setExcludes(fileSet.getExcludes().toArray(new String[0])); // NOPMD
        scanner.scan();
        for (final String includedFile : scanner.getIncludedFiles()) {

            final File inputFile = new File(baseDirectory, // NOPMD
                    includedFile);
            final String basename = includedFile.substring(0, includedFile.lastIndexOf('.'));
            final File svgFile = new File(destDir, basename + ".svg"); // NOPMD
            try {
                final PrintStream ps = new PrintStream(// NOPMD
                        buildContext.newFileOutputStream(svgFile));
                SvgFontUtil.writeFontAsSvg(ps, Font.create(inputFile.toString()), basename);
                ps.close();
            } catch (final Exception e) {
                throw new MojoExecutionException(String.format(R.getString("failedtorender"), inputFile), e);
            }
        }
    }

}
 
开发者ID:trajano,项目名称:batik-maven-plugin,代码行数:46,代码来源:FontConverterMojo.java

示例8: mergeFileSet_Directory

import org.apache.maven.model.FileSet; //导入方法依赖的package包/类
protected void mergeFileSet_Directory( FileSet target, FileSet source, boolean sourceDominant,
                                       Map<Object, Object> context )
{
    String src = source.getDirectory();
    if ( src != null )
    {
        if ( sourceDominant || target.getDirectory() == null )
        {
            target.setDirectory( src );
            target.setLocation( "directory", source.getLocation( "directory" ) );
        }
    }
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:14,代码来源:ModelMerger.java

示例9: toFileList

import org.apache.maven.model.FileSet; //导入方法依赖的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

示例10: createFileSetUris

import org.apache.maven.model.FileSet; //导入方法依赖的package包/类
private List<URI> createFileSetUris(final FileSet fileset,
		String defaultDirectory, String[] defaultIncludes,
		String defaultExcludes[]) throws MojoExecutionException {
	final String draftDirectory = fileset.getDirectory();
	final String directory = draftDirectory == null ? defaultDirectory
			: draftDirectory;
	final List<String> includes;
	@SuppressWarnings("unchecked")
	final List<String> draftIncludes = (List<String>) fileset.getIncludes();
	if (draftIncludes == null || draftIncludes.isEmpty()) {
		includes = defaultIncludes == null ? Collections
				.<String> emptyList() : Arrays.asList(defaultIncludes);
	} else {
		includes = draftIncludes;
	}

	final List<String> excludes;
	@SuppressWarnings("unchecked")
	final List<String> draftExcludes = (List<String>) fileset.getExcludes();
	if (draftExcludes == null || draftExcludes.isEmpty()) {
		excludes = defaultExcludes == null ? Collections
				.<String> emptyList() : Arrays.asList(defaultExcludes);
	} else {
		excludes = draftExcludes;
	}
	String[] includesArray = includes.toArray(new String[includes.size()]);
	String[] excludesArray = excludes.toArray(new String[excludes.size()]);
	try {
		final List<File> files = IOUtils.scanDirectoryForFiles(
				getBuildContext(), new File(directory), includesArray,
				excludesArray, !getDisableDefaultExcludes());

		final List<URI> uris = new ArrayList<URI>(files.size());

		for (final File file : files) {
			// try {
			final URI uri = file.toURI();
			uris.add(uri);
			// } catch (MalformedURLException murlex) {
			// throw new MojoExecutionException(
			// MessageFormat.format(
			// "Could not create an URL for the file [{0}].",
			// file), murlex);
			// }
		}
		return uris;
	} catch (IOException ioex) {
		throw new MojoExecutionException(
				MessageFormat
						.format("Could not scan directory [{0}] for files with inclusion [{1}]  and exclusion [{2}].",
								directory, includes, excludes));
	}
}
 
开发者ID:highsource,项目名称:maven-jaxb2-plugin,代码行数:54,代码来源:AbstractXJC2Mojo.java


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