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


Java FileSet.setDirectory方法代码示例

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


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

示例1: testFailWithWithDTDs

import org.apache.maven.model.FileSet; //导入方法依赖的package包/类
@Test(expected = MojoExecutionException.class)
public void testFailWithWithDTDs() throws Exception {

    final File testPom = new File("src/test/resources/net/trajano/mojo/cleanpom/cleaner-pom.xml");
    final File xml = new File("src/test/resources/net/trajano/mojo/cleanpom/dual-doctype.xml");
    final File temp = File.createTempFile("dirty", "");
    temp.delete();
    temp.mkdirs();
    FileUtils.copyFile(xml, new File(temp, "dirty1.xml"));

    final CleanXmlMojo mojo = (CleanXmlMojo) rule.lookupMojo("clean-xml", testPom);
    final FileSet xmlFiles = new FileSet();
    xmlFiles.setDirectory(temp.getAbsolutePath());
    xmlFiles.addInclude("**/*.xml");
    rule.setVariableValueToObject(mojo, "xmlFileSets", new FileSet[] {
        xmlFiles
    });
    assertNotNull(mojo);
    try {
        mojo.execute();
    } finally {
        FileUtils.deleteDirectory(temp);
    }
}
 
开发者ID:trajano,项目名称:cleanpom-maven-plugin,代码行数:25,代码来源:CleanXmlMojoTest.java

示例2: initFiles

import org.apache.maven.model.FileSet; //导入方法依赖的package包/类
/**
 * This method retrieves a list of ".aliaslib" files to process in the
 * source directory (usually "target/src") which is a copy of the actual
 * source directory used to compile the TIBCO BusinessWorks EAR.
 */
private List<File> initFiles() throws IOException {
	FileSet restriction = new FileSet();
	File directory = buildSrcDirectory;
	if (directory == null) {
		directory = new File(".");
		getLog().warn(SRC_NOT_SET);
	}

	getLog().debug(directory.getAbsolutePath());
	restriction.setDirectory(directory.getAbsolutePath());

	restriction.addInclude("**/*.aliaslib");

	List<File> result = AbstractProjectsListMojo.toFileList(restriction);

	if (customAliasLibDirectories != null && !customAliasLibDirectories.isEmpty()) {
		for (File customDirectory : customAliasLibDirectories) {
			getLog().debug("Looking for '.aliaslib' files in custom directory: " + customDirectory);
			FileSet customRestriction = new FileSet();
			customRestriction.setDirectory(customDirectory.getAbsolutePath());
			customRestriction.addInclude("**/*.aliaslib");
			result.addAll(AbstractProjectsListMojo.toFileList(customRestriction));
		}
	}

	getLog().debug("List of '.aliaslib' files to update: " + result);
	return result;
}
 
开发者ID:fastconnect,项目名称:tibco-bwmaven,代码行数:34,代码来源:UpdateAliasesLibsMojo.java

示例3: initProjects

import org.apache.maven.model.FileSet; //导入方法依赖的package包/类
protected final void initProjects(String mandatoryFilename, HashMap<String, String> m, Class<? extends AbstractProject> classAbstractProject) throws IOException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, SecurityException, NoSuchMethodException, XmlPullParserException {
	projects = new ArrayList<AbstractProject>();
	
	restriction= new FileSet();
	restriction.setDirectory(workspaceRoot.getAbsolutePath());
	
	if (recursive) {
		for (String p : patterns) {
			restriction.addInclude(p + mandatoryFilename);
		}
	} else {
		restriction.addInclude(mandatoryFilename); // we are only looking in the "workspaceRoot" directory
	}
	restriction.addExclude("**/target/**/" + mandatoryFilename);
	restriction.addExclude("**/bin/" + mandatoryFilename);
	
	List<File> files = toFileList(restriction);
	
	for (File f : files) {
		Constructor<? extends AbstractProject> ctor = classAbstractProject.getConstructor();
		AbstractProject ap = ctor.newInstance();
		
		ap.initialize(f, workspaceRoot, m, mandatoryFilename, getLog());
		if (!ap.isIgnored()) {
			projects.add(ap);
		} else {
			getLog().debug("Ignoring project '" + ap.getProjectName() + "'");
		}
	}
}
 
开发者ID:fastconnect,项目名称:tibco-bwmaven,代码行数:31,代码来源:AbstractProjectsListMojo.java

示例4: initFiles

import org.apache.maven.model.FileSet; //导入方法依赖的package包/类
protected List<File> initFiles() throws IOException {
	getLog().debug("Looking for files to process...");

	FileSet restriction = new FileSet();
	File directory = getDirectoryToProcess();
	if (directory == null) {
		directory = new File(".");
	}
	restriction.setDirectory(directory.getAbsolutePath());
	
	restriction.addInclude("**/*.process");
	
	return AbstractProjectsListMojo.toFileList(restriction);
}
 
开发者ID:fastconnect,项目名称:tibco-bwmaven,代码行数:15,代码来源:AbstractDocMojo.java

示例5: initFiles

import org.apache.maven.model.FileSet; //导入方法依赖的package包/类
@Override
protected List<File> initFiles() throws IOException {
	getLog().debug("Looking for files to process...");

	FileSet restriction = new FileSet();
	restriction.setDirectory(getDirectoryToProcess().getAbsolutePath());
	
	restriction.addInclude("**/*.xml");
	
	return AbstractProjectsListMojo.toFileList(restriction);
}
 
开发者ID:fastconnect,项目名称:tibco-bwmaven,代码行数:12,代码来源:GenerateAPTDocMojo.java

示例6: 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

示例7: testWithDTDAndPI

import org.apache.maven.model.FileSet; //导入方法依赖的package包/类
@Test
public void testWithDTDAndPI() throws Exception {

    final File testPom = new File("src/test/resources/net/trajano/mojo/cleanpom/cleaner-pom.xml");
    final File xml = new File("src/test/resources/net/trajano/mojo/cleanpom/checkstyle-configuration-with-pi.xml");
    final File temp = File.createTempFile("dirty", "");
    temp.delete();
    temp.mkdirs();
    FileUtils.copyFile(xml, new File(temp, "dirty1.xml"));

    final CleanXmlMojo mojo = (CleanXmlMojo) rule.lookupMojo("clean-xml", testPom);
    final FileSet xmlFiles = new FileSet();
    xmlFiles.setDirectory(temp.getAbsolutePath());
    xmlFiles.addInclude("**/*.xml");
    rule.setVariableValueToObject(mojo, "xmlFileSets", new FileSet[] {
        xmlFiles
    });
    assertNotNull(mojo);
    try {
        mojo.execute();
        final FileInputStream fileInputStream = new FileInputStream(new File(temp, "dirty1.xml"));
        final String data = IOUtils.toString(fileInputStream);
        assertTrue(data.length() > 10);
        fileInputStream.close();
    } finally {
        FileUtils.deleteDirectory(temp);
    }

}
 
开发者ID:trajano,项目名称:cleanpom-maven-plugin,代码行数:30,代码来源:CleanXmlMojoTest.java

示例8: testWithPI

import org.apache.maven.model.FileSet; //导入方法依赖的package包/类
@Test
public void testWithPI() throws Exception {

    final File testPom = new File("src/test/resources/net/trajano/mojo/cleanpom/cleaner-pom.xml");
    final File xml = new File("src/test/resources/net/trajano/mojo/cleanpom/dirty-with-pi.xml");
    final File temp = File.createTempFile("dirty", "");
    temp.delete();
    temp.mkdirs();
    FileUtils.copyFile(xml, new File(temp, "dirty1.xml"));

    final CleanXmlMojo mojo = (CleanXmlMojo) rule.lookupMojo("clean-xml", testPom);
    final FileSet xmlFiles = new FileSet();
    xmlFiles.setDirectory(temp.getAbsolutePath());
    xmlFiles.addInclude("**/*.xml");
    rule.setVariableValueToObject(mojo, "xmlFileSets", new FileSet[] {
        xmlFiles
    });
    assertNotNull(mojo);
    try {
        mojo.execute();
        final FileInputStream fileInputStream = new FileInputStream(new File(temp, "dirty1.xml"));
        final String data = IOUtils.toString(fileInputStream);
        fileInputStream.close();
        assertTrue(data.contains("<?xml-stylesheet type=\"text/xsl\" href=\"style.xsl\"?>"));
    } finally {
        FileUtils.deleteDirectory(temp);
    }

}
 
开发者ID:trajano,项目名称:cleanpom-maven-plugin,代码行数:30,代码来源:CleanXmlMojoTest.java

示例9: getFileSetsWithNonExistentIncludes

import org.apache.maven.model.FileSet; //导入方法依赖的package包/类
private List<FileSet> getFileSetsWithNonExistentIncludes(final Path rootDir) throws IOException {
  final List<FileSet> fileSets = getFileSets(rootDir);

  final FileSet fileSet = new FileSet();
  fileSet.setDirectory(rootDir.toString());

  for (final String arg : BAD_ARGS) {
    fileSet.addInclude(arg);
  }

  fileSets.add(fileSet);
  return fileSets;
}
 
开发者ID:protobufel,项目名称:protobuf-el,代码行数:14,代码来源:ExecMojoTest.java

示例10: getFileSetsWithDuplicates

import org.apache.maven.model.FileSet; //导入方法依赖的package包/类
private List<FileSet> getFileSetsWithDuplicates(final Path rootDir) throws IOException {
  final List<FileSet> fileSets = getFileSets(rootDir);

  final FileSet fileSet = new FileSet();
  fileSet.setDirectory(rootDir.toString());
  fileSet.addInclude("**/file4");

  fileSets.add(fileSet);
  return fileSets;
}
 
开发者ID:protobufel,项目名称:protobuf-el,代码行数:11,代码来源:ExecMojoTest.java

示例11: 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


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