private void buildAntTask(String AntDirectory, ArrayList<TDeployLine> DeployLines, Integer orgindex) {
		TStringList packagexml = new TStringList();
		packagexml.add("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
		packagexml.add("<Package xmlns=\"http://soap.sforce.com/2006/04/metadata\">");

		TStringList classesxml = new TStringList();
		classesxml.AllowDuplicates = false;
		classesxml.Sorted = true;

		TStringList componentsxml = new TStringList();
		componentsxml.AllowDuplicates = false;
		componentsxml.Sorted = true;

		TStringList pagesxml = new TStringList();
		pagesxml.AllowDuplicates = false;
		pagesxml.Sorted = true;

		TStringList staticresourcesxml = new TStringList();
		staticresourcesxml.AllowDuplicates = false;
		staticresourcesxml.Sorted = true;

		TStringList triggersxml = new TStringList();
		triggersxml.AllowDuplicates = false;
		triggersxml.Sorted = true;

		Integer DeployResourcesCount = 0;
		for (Integer i = 0; i < DeployLines.size(); i++) {
			TDeployLine deployLine = DeployLines.get(i);
			TDeployItem deployItem = deployLine.DeployItems.get(orgindex);
			if (deployItem.getIsIncludedToDeploy()) {
				String res1 = deployLine.ResourcePath;
				String res2 = deployLine.getMetaXmlPath();
				copyResource(res1, DeployOrganizations.get(orgindex).Directory);
				if (res2 != null) {
					copyResource(res2, DeployOrganizations.get(orgindex).Directory);
				}
				String resname = res1.substring(res1.indexOf(FILE_SEPARATOR)+1, res1.indexOf("."));
				if (res1.indexOf("classes"+FILE_SEPARATOR) != -1) {
					classesxml.add(resname);
				}
				if (res1.indexOf("components"+FILE_SEPARATOR) != -1) {
					componentsxml.add(resname);
				}
				if (res1.indexOf("pages"+FILE_SEPARATOR) != -1) {
					pagesxml.add(resname);
				}
				if (res1.indexOf("staticresources"+FILE_SEPARATOR) != -1) {
					staticresourcesxml.add(resname);
				}
				if (res1.indexOf("triggers"+FILE_SEPARATOR) != -1) {
					triggersxml.add(resname);
				}
				DeployResourcesCount++;
			}
		}
		addTypes(packagexml, classesxml, "ApexClass");
		addTypes(packagexml, componentsxml, "ApexComponent");
		addTypes(packagexml, pagesxml, "ApexPage");
		addTypes(packagexml, staticresourcesxml, "StaticResource");
		addTypes(packagexml, triggersxml, "ApexTrigger");

		DeployOrganizations.get(orgindex).DeployResourcesCount = DeployResourcesCount;

		packagexml.add("    <version>31.0</version>");
		packagexml.add("</Package>");
		packagexml.SaveToFile(AntDirectory + FILE_SEPARATOR + "package.xml");
	}