當前位置: 首頁>>代碼示例>>Java>>正文


Java FileSet.setExcludes方法代碼示例

本文整理匯總了Java中org.apache.tools.ant.types.FileSet.setExcludes方法的典型用法代碼示例。如果您正苦於以下問題:Java FileSet.setExcludes方法的具體用法?Java FileSet.setExcludes怎麽用?Java FileSet.setExcludes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.tools.ant.types.FileSet的用法示例。


在下文中一共展示了FileSet.setExcludes方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: compress

import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
/**
 * ʹ��zipѹ���ļ�
 * 
 * @param source
 *            ��Ҫѹ�����ļ�
 * @param target
 *            ѹ�����ļ��Ĵ��·��
 * @param delflag
 *            ѹ�����Ƿ�ɾ��Դ�ļ�
 */
public static void compress(File source, File target, boolean delflag) {
	if (!target.exists()) {
		target.mkdirs();
	}
	File zipFile = new File(target.getAbsolutePath() + File.separator
			+ source.getName() + ".zip");
	Project prj = new Project();
	org.apache.tools.ant.taskdefs.Zip zip = new org.apache.tools.ant.taskdefs.Zip();
	zip.setProject(prj);
	zip.setDestFile(zipFile);
	FileSet fileSet = new FileSet();
	fileSet.setProject(prj);
	fileSet.setDir(target);
	// ������Щ�ļ����ļ���
	fileSet.setIncludes(source.getName());
	// �ų���Щ�ļ����ļ���
	fileSet.setExcludes("*.zip");
	zip.addFileset(fileSet);
	zip.execute();
	if (delflag) {
		source.delete();
	}
}
 
開發者ID:Petasoft,項目名稱:Export,代碼行數:34,代碼來源:Zip.java

示例2: testSimple

import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
@Test
public void testSimple() {
    FileSet fs = new FileSet();
    fs.setDir(new File("test/buildlist"));
    fs.setIncludes("**/build.xml");
    fs.setExcludes("E2/build.xml,F/build.xml,G/build.xml");

    buildlist.addFileset(fs);
    buildlist.setOnMissingDescriptor("skip");

    String[] files = getFiles(buildlist);

    assertEquals(5, files.length);

    assertListOfFiles("test/buildlist/", new String[] {"B", "C", "A", "D", "E"}, files);
}
 
開發者ID:apache,項目名稱:ant-ivy,代碼行數:17,代碼來源:IvyBuildListTest.java

示例3: testReverse

import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
@Test
public void testReverse() {
    FileSet fs = new FileSet();
    fs.setDir(new File("test/buildlist"));
    fs.setIncludes("**/build.xml");
    fs.setExcludes("E2/build.xml,F/build.xml,G/build.xml");

    buildlist.addFileset(fs);
    buildlist.setReverse(true);
    buildlist.setOnMissingDescriptor("skip");

    String[] files = getFiles(buildlist);

    assertEquals(5, files.length);

    assertListOfFiles("test/buildlist/", new String[] {"E", "D", "A", "C", "B"}, files);
}
 
開發者ID:apache,項目名稱:ant-ivy,代碼行數:18,代碼來源:IvyBuildListTest.java

示例4: testWithRoot

import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
@Test
public void testWithRoot() {
    FileSet fs = new FileSet();
    fs.setDir(new File("test/buildlist"));
    fs.setIncludes("**/build.xml");
    fs.setExcludes("E2/**");

    buildlist.addFileset(fs);
    buildlist.setRoot("C");
    buildlist.setOnMissingDescriptor("skip");

    String[] files = getFiles(buildlist);

    assertEquals(2, files.length); // A and D should be filtered out

    assertListOfFiles("test/buildlist/", new String[] {"B", "C"}, files);
}
 
開發者ID:apache,項目名稱:ant-ivy,代碼行數:18,代碼來源:IvyBuildListTest.java

示例5: testWithTwoRoots

import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
@Test
public void testWithTwoRoots() {
    FileSet fs = new FileSet();
    fs.setDir(new File("test/buildlist"));
    fs.setIncludes("**/build.xml");
    fs.setExcludes("E2/**");

    buildlist.addFileset(fs);
    buildlist.setRoot("C,E");
    buildlist.setOnMissingDescriptor("skip");

    String[] files = getFiles(buildlist);

    assertEquals(3, files.length); // A and D should be filtered out

    assertListOfFiles("test/buildlist/", new String[] {"B", "C", "E"}, files);
}
 
開發者ID:apache,項目名稱:ant-ivy,代碼行數:18,代碼來源:IvyBuildListTest.java

示例6: testWithRootExclude

import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
@Test
public void testWithRootExclude() {
    FileSet fs = new FileSet();
    fs.setDir(new File("test/buildlist"));
    fs.setIncludes("**/build.xml");
    fs.setExcludes("E2/**");

    buildlist.addFileset(fs);
    buildlist.setRoot("C");
    buildlist.setExcludeRoot(true);
    buildlist.setOnMissingDescriptor("skip");

    String[] files = getFiles(buildlist);

    assertEquals(1, files.length); // A, D and C should be filtered out

    assertListOfFiles("test/buildlist/", new String[] {"B"}, files);
}
 
開發者ID:apache,項目名稱:ant-ivy,代碼行數:19,代碼來源:IvyBuildListTest.java

示例7: testWithRootAndOnlyDirectDep

import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
@Test
public void testWithRootAndOnlyDirectDep() {
    FileSet fs = new FileSet();
    fs.setDir(new File("test/buildlist"));
    fs.setIncludes("**/build.xml");
    fs.setExcludes("E2/**");

    buildlist.addFileset(fs);
    buildlist.setRoot("A");
    buildlist.setOnlydirectdep(true);
    buildlist.setOnMissingDescriptor("skip");

    String[] files = getFiles(buildlist);

    assertEquals(2, files.length); // We should have only A and C

    assertListOfFiles("test/buildlist/", new String[] {"C", "A"}, files);
}
 
開發者ID:apache,項目名稱:ant-ivy,代碼行數:19,代碼來源:IvyBuildListTest.java

示例8: testWithLeaf

import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
@Test
public void testWithLeaf() {
    FileSet fs = new FileSet();
    fs.setDir(new File("test/buildlist"));
    fs.setIncludes("**/build.xml");
    fs.setExcludes("E2/**");

    buildlist.addFileset(fs);
    buildlist.setLeaf("C");
    buildlist.setOnMissingDescriptor("skip");

    String[] files = getFiles(buildlist);

    assertEquals(3, files.length); // B should be filtered out

    assertListOfFiles("test/buildlist/", new String[] {"C", "A", "D"}, files);
}
 
開發者ID:apache,項目名稱:ant-ivy,代碼行數:18,代碼來源:IvyBuildListTest.java

示例9: testWithTwoLeafs

import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
@Test
public void testWithTwoLeafs() {
    FileSet fs = new FileSet();
    fs.setDir(new File("test/buildlist"));
    fs.setIncludes("**/build.xml");
    fs.setExcludes("E2/**");

    buildlist.addFileset(fs);
    buildlist.setLeaf("C,E");
    buildlist.setOnMissingDescriptor("skip");

    String[] files = getFiles(buildlist);

    assertEquals(4, files.length); // B should be filtered out

    assertListOfFiles("test/buildlist/", new String[] {"C", "A", "D", "E"}, files);
}
 
開發者ID:apache,項目名稱:ant-ivy,代碼行數:18,代碼來源:IvyBuildListTest.java

示例10: testWithLeafExclude

import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
@Test
public void testWithLeafExclude() {
    FileSet fs = new FileSet();
    fs.setDir(new File("test/buildlist"));
    fs.setIncludes("**/build.xml");
    fs.setExcludes("E2/**");

    buildlist.addFileset(fs);
    buildlist.setLeaf("C");
    buildlist.setExcludeLeaf(true);
    buildlist.setOnMissingDescriptor("skip");

    String[] files = getFiles(buildlist);

    assertEquals(2, files.length); // B and C should be filtered out

    assertListOfFiles("test/buildlist/", new String[] {"A", "D"}, files);
}
 
開發者ID:apache,項目名稱:ant-ivy,代碼行數:19,代碼來源:IvyBuildListTest.java

示例11: testWithLeafAndOnlyDirectDep

import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
@Test
public void testWithLeafAndOnlyDirectDep() {
    FileSet fs = new FileSet();
    fs.setDir(new File("test/buildlist"));
    fs.setIncludes("**/build.xml");
    fs.setExcludes("E2/**");

    buildlist.addFileset(fs);
    buildlist.setOnMissingDescriptor("skip");
    buildlist.setLeaf("C");
    buildlist.setOnlydirectdep(true);

    String[] files = getFiles(buildlist);

    assertEquals(2, files.length); // We must have only A and C

    assertListOfFiles("test/buildlist/", new String[] {"C", "A"}, files);
}
 
開發者ID:apache,項目名稱:ant-ivy,代碼行數:19,代碼來源:IvyBuildListTest.java

示例12: testRestartFrom

import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
@Test
public void testRestartFrom() {
    FileSet fs = new FileSet();
    fs.setDir(new File("test/buildlist"));
    fs.setIncludes("**/build.xml");
    fs.setExcludes("E2/build.xml,F/build.xml,G/build.xml");

    buildlist.addFileset(fs);
    buildlist.setOnMissingDescriptor("skip");
    buildlist.setRestartFrom("C");

    String[] files = getFiles(buildlist);

    assertEquals(4, files.length);

    assertListOfFiles("test/buildlist/", new String[] {"C", "A", "D", "E"}, files);
}
 
開發者ID:apache,項目名稱:ant-ivy,代碼行數:18,代碼來源:IvyBuildListTest.java

示例13: testOnMissingDescriptor

import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
@Test
public void testOnMissingDescriptor() {
    FileSet fs = new FileSet();
    fs.setDir(new File("test/buildlist"));
    fs.setIncludes("**/build.xml");
    fs.setExcludes("E2/build.xml,F/build.xml,G/build.xml");

    buildlist.addFileset(fs);
    buildlist.setOnMissingDescriptor("tail"); // IVY-805: new String instance

    String[] files = getFiles(buildlist);

    assertEquals(6, files.length);

    assertListOfFiles("test/buildlist/", new String[] {"B", "C", "A", "D", "E", "H"}, files);
}
 
開發者ID:apache,項目名稱:ant-ivy,代碼行數:17,代碼來源:IvyBuildListTest.java

示例14: testOnMissingDescriptor2

import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
@Test
public void testOnMissingDescriptor2() {
    FileSet fs = new FileSet();
    fs.setDir(new File("test/buildlist"));
    fs.setIncludes("**/build.xml");
    fs.setExcludes("E2/build.xml,F/build.xml,G/build.xml");

    buildlist.addFileset(fs);
    buildlist.setOnMissingDescriptor("skip"); // IVY-805: new String instance

    String[] files = getFiles(buildlist);

    assertEquals(5, files.length);

    assertListOfFiles("test/buildlist/", new String[] {"B", "C", "A", "D", "E"}, files);
}
 
開發者ID:apache,項目名稱:ant-ivy,代碼行數:17,代碼來源:IvyBuildListTest.java

示例15: testWithModuleWithSameNameAndDifferentOrg

import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
@Test
public void testWithModuleWithSameNameAndDifferentOrg() {
    FileSet fs = new FileSet();
    fs.setDir(new File("test/buildlist"));
    fs.setIncludes("**/build.xml");
    fs.setExcludes("F/build.xml,G/build.xml");

    buildlist.addFileset(fs);
    buildlist.setOnMissingDescriptor("skip");

    String[] files = getFiles(buildlist);

    assertEquals(6, files.length);

    assertListOfFiles("test/buildlist/", new String[] {"B", "C", "A", "D"}, files);

    // the order of E and E2 is undefined
    List<URI> other = new ArrayList<>();
    other.add(new File(files[4]).getAbsoluteFile().toURI());
    other.add(new File(files[5]).getAbsoluteFile().toURI());
    Collections.sort(other);

    assertEquals(new File("test/buildlist/E/build.xml").getAbsoluteFile().toURI(), other.get(0));
    assertEquals(new File("test/buildlist/E2/build.xml").getAbsoluteFile().toURI(),
        other.get(1));
}
 
開發者ID:apache,項目名稱:ant-ivy,代碼行數:27,代碼來源:IvyBuildListTest.java


注:本文中的org.apache.tools.ant.types.FileSet.setExcludes方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。