• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Target类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: copyFile

import org.apache.tools.ant.Target; //导入依赖的package包/类
static public void copyFile(File src, File obj) {
	final class AntCopy extends Copy {
		@SuppressWarnings("deprecation")
		public AntCopy() {
			project = new Project();
			project.init();
			taskType = "copy";
			taskName = "copy";
			target = new Target();
		}
	}

	AntCopy ant = new AntCopy();
	ant.setFile(src);
	ant.setTofile(obj);
	ant.execute();
}
 
开发者ID:AbnerLin,项目名称:PLWeb-Destop-Version,代码行数:18,代码来源:AntTask.java


示例2: configureTask

import org.apache.tools.ant.Target; //导入依赖的package包/类
private static void configureTask(Target target, AntTarget task, File baseDir, Transformer<? extends String, ? super String> taskNamer) {
    task.setTarget(target);
    task.setBaseDir(baseDir);

    final List<String> taskDependencyNames = getTaskDependencyNames(target, taskNamer);
    task.dependsOn(new AntTargetsTaskDependency(taskDependencyNames));
    addDependencyOrdering(taskDependencyNames, task.getProject().getTasks());
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:9,代码来源:DefaultAntBuilder.java


示例3: BasicAntBuilder

import org.apache.tools.ant.Target; //导入依赖的package包/类
public BasicAntBuilder() {
    // These are used to discard references to tasks so they can be garbage collected
    Field collectorField;
    try {
        nodeField = AntBuilder.class.getDeclaredField("lastCompletedNode");
        nodeField.setAccessible(true);
        collectorField = AntBuilder.class.getDeclaredField("collectorTarget");
        collectorField.setAccessible(true);
        Target target = (Target) collectorField.get(this);
        Field childrenField = Target.class.getDeclaredField("children");
        childrenField.setAccessible(true);
        children = (List) childrenField.get(target);
    } catch (Exception e) {
        throw new RuntimeException(e);
    }

    getAntProject().addDataTypeDefinition("gradleFileResource", AntFileResource.class);
    getAntProject().addDataTypeDefinition("gradleBaseDirSelector", BaseDirSelector.class);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:20,代码来源:BasicAntBuilder.java


示例4: testInstallAllTargetWithClusters

import org.apache.tools.ant.Target; //导入依赖的package包/类
public void testInstallAllTargetWithClusters() {
    
    InsertModuleAllTargets insert = new InsertModuleAllTargets();
    insert.setProject(p);
    
    insert.execute();

    Object obj = p.getTargets().get("all-java.source.queries");
    assertNotNull("Target found", obj);
    Target t = (Target)obj;
    
    Set<String> s = depsToNames(t.getDependencies());
    assertEquals("One dep: " + s, 1, s.size());
    assertEquals("Just dep on init", "init", s.iterator().next());
    
    int callTargets = 0;
    for (Task task : t.getTasks()) {
        if (task instanceof CallTarget) {
            callTargets++;
        }
    }
    assertEquals("One call target to build super cluster", 1, callTargets);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:InsertModuleAllTargetsTest.java


示例5: testInstallAllTargetWithoutClusters

import org.apache.tools.ant.Target; //导入依赖的package包/类
public void testInstallAllTargetWithoutClusters() {
    InsertModuleAllTargets insert = new InsertModuleAllTargets();
    insert.setProject(p);
    insert.setUseClusters(false);
    insert.execute();

    Object obj = p.getTargets().get("all-java.source.queries");
    assertNotNull("Target found", obj);
    Target t = (Target)obj;
    
    Set<String> s = depsToNames(t.getDependencies());
    assertEquals("Three dependencies: " + s, 5, s.size());
    assertTrue("on init", s.contains("init"));
    assertTrue("on all-openide.util", s.contains("all-openide.util"));
    assertTrue("on all-openide.util.lookup", s.contains("all-openide.util.lookup"));
    assertTrue("on all-api.annotations.common", s.contains("all-api.annotations.common"));
    assertTrue("on all-openide.dialogs", s.contains("all-openide.dialogs"));
    
    int callTargets = 0;
    for (Task task : t.getTasks()) {
        if (task instanceof CallTarget) {
            callTargets++;
        }
    }
    assertEquals("No call targes", 0, callTargets);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:InsertModuleAllTargetsTest.java


示例6: execute

import org.apache.tools.ant.Target; //导入依赖的package包/类
/**
 * Execute all tasks.
 *
 * @exception BuildException  Description of Exception
 */
public void execute() throws BuildException {
   for ( int i = initValue; i < maxValue; i += inc ) {
      if ( initName != null ) {
         getProject().setUserProperty( initName, String.valueOf( i ) );
      }
      Target target = new Target();
      target.setName( "for.subtarget" );
      getProject().addOrReplaceTarget( target );
      for ( Enumeration e = tasks.elements(); e.hasMoreElements();  ) {
         Task task = (Task)e.nextElement();
         addTaskToTarget( target, task );
      }
      
      target.execute();
   }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:22,代码来源:ForTask.java


示例7: addTaskToTarget

import org.apache.tools.ant.Target; //导入依赖的package包/类
private void addTaskToTarget( Target target, Task task ) {
   UnknownElement replacement = new UnknownElement( taskType );  // shouldn't do taskType, for Ant 1.6 and later there is a getTaskType method
   replacement.setProject( getProject() );
   invokeMethod( replacement, "setTaskType", taskType );
   replacement.setTaskName( task.getTaskName() );
   replacement.setLocation( task.getLocation() );
   replacement.setOwningTarget( target );
   replacement.setRuntimeConfigurableWrapper( task.getRuntimeConfigurableWrapper() );
   invokeMethod( task.getRuntimeConfigurableWrapper(), "setProxy", replacement );
   replacement.maybeConfigure();
   log("replacement is a " + replacement.getTaskName() + ", " + replacement.getClass().getName());
   if (replacement instanceof TaskContainer) {
      log("replacement is a TaskContainer");
      invokeMethod(replacement, "handleChildren", new Object[]{this, this.getRuntimeConfigurableWrapper()});
   }
   target.addTask(replacement);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:18,代码来源:ForTask.java


示例8: extracted

import org.apache.tools.ant.Target; //导入依赖的package包/类
private Target extracted(Project p) {

		Target target = new Target() {
			//			@Override
			//			public Project getProject() {
			//				return p;
			//			}
		};
		target.setProject(p);

		target.setName("Hello build");
		target.setDescription("Runtime Adding Target");

		Echo echo = new Echo();
		echo.setMessage("Hello ant build");
		echo.setProject(p);
		target.addTask(echo);
		return target;
	}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:20,代码来源:AntJavaCompilerTest.java


示例9: removeFiles

import org.apache.tools.ant.Target; //导入依赖的package包/类
/**
 * Removes files from a given zip file.
 * 
 * @param zipFile name of the zip file to be modified
 * @param removePattern pattern of the files to be removed
 * 
 * @throws IOException
 */
public static void removeFiles(File zipFile, String removePattern) throws IOException {
    String zipFileName = zipFile.getName();
    File tmpFile = new File(zipFile.getCanonicalPath() + ".tmp");
    Project antProject = new Project();
    Target antTarget = new Target();
    antProject.addTarget("zip", antTarget);
    Zip zipTask = new Zip();
    zipTask.setProject(antProject);
    zipTask.setDestFile(tmpFile);
    ZipFileSet set = new ZipFileSet();
    set.setSrc(zipFile);
    set.setExcludes(removePattern);
    zipTask.addZipfileset(set);
    antTarget.addTask(zipTask);
    antTarget.execute();
    zipFile.delete();
    tmpFile.renameTo(new File(tmpFile.getParentFile(), zipFileName));
}
 
开发者ID:bretthshelley,项目名称:Maven-IIB9-Plug-In,代码行数:27,代码来源:ZipUtils.java


示例10: AntBuilder

import org.apache.tools.ant.Target; //导入依赖的package包/类
public AntBuilder(final Project project, final Target owningTarget) {
    this.project = project;

    /*
     * GROOVY-4524: The following is not needed anymore as an ant Project already by default has inputhandler
     * set to DefaultInputHandler. And if it is again set here, it mistakenly overrides the custom input handler
     * if set using -inputhandler switch. 
     */
    //this.project.setInputHandler(new DefaultInputHandler());

    collectorTarget = owningTarget;
    antXmlContext = new AntXMLContext(project);
    collectorTarget.setProject(project);
    antXmlContext.setCurrentTarget(collectorTarget);
    antXmlContext.setLocator(new AntBuilderLocator());
    antXmlContext.setCurrentTargets(new HashMap<String, Target>());

    implicitTarget = new Target();
    implicitTarget.setProject(project);
    implicitTarget.setName("");
    antXmlContext.setImplicitTarget(implicitTarget);

    // FileScanner is a Groovy utility
    project.addDataTypeDefinition("fileScanner", FileScanner.class);
}
 
开发者ID:apache,项目名称:groovy,代码行数:26,代码来源:AntBuilder.java


示例11: onDefineTarget

import org.apache.tools.ant.Target; //导入依赖的package包/类
private Target onDefineTarget(final Attributes attrs, String tagName, String ns) {
    final Target target = new Target();
    target.setProject(project);
    target.setLocation(new Location(antXmlContext.getLocator()));
    try {
        antTargetHandler.onStartElement(ns, tagName, tagName, attrs, antXmlContext);
        final Target newTarget = getProject().getTargets().get(attrs.getValue("name"));
        antXmlContext.setCurrentTarget(newTarget);
        definingTarget = newTarget;
        return newTarget;
    }
    catch (final SAXParseException e) {
        log.log(Level.SEVERE, "Caught: " + e, e);
    }
    return null;
}
 
开发者ID:apache,项目名称:groovy,代码行数:17,代码来源:AntBuilder.java


示例12: onStartTarget

import org.apache.tools.ant.Target; //导入依赖的package包/类
private Target onStartTarget(final Attributes attrs, String tagName, String ns) {
    final Target target = new Target();
    target.setProject(project);
    target.setLocation(new Location(antXmlContext.getLocator()));
    try {
        antTargetHandler.onStartElement(ns, tagName, tagName, attrs, antXmlContext);
        final Target newTarget = getProject().getTargets().get(attrs.getValue("name"));

        // execute dependencies (if any)
        final Vector<Target> targets = new Vector<Target>();
        for (final Enumeration<String> deps = newTarget.getDependencies(); deps.hasMoreElements();) {
            final String targetName = deps.nextElement();
            targets.add(project.getTargets().get(targetName));
        }
        getProject().executeSortedTargets(targets);

        antXmlContext.setCurrentTarget(newTarget);
        return newTarget;
    }
    catch (final SAXParseException e) {
        log.log(Level.SEVERE, "Caught: " + e, e);
    }
    return null;
}
 
开发者ID:apache,项目名称:groovy,代码行数:25,代码来源:AntBuilder.java


示例13: zipDir

import org.apache.tools.ant.Target; //导入依赖的package包/类
static public void zipDir(File destFile, File zipFile) {
	final class AntZIP extends Zip {
		@SuppressWarnings("deprecation")
		public AntZIP() {
			project = new Project();
			project.init();
			taskType = "zip";
			taskName = "zip";
			target = new Target();
		}
	}

	AntZIP zip = new AntZIP();
	zip.setBasedir(zipFile);
	zip.setDestFile(destFile);
	zip.execute();
}
 
开发者ID:AbnerLin,项目名称:PLWeb-Destop-Version,代码行数:18,代码来源:AntTask.java


示例14: unzipFile

import org.apache.tools.ant.Target; //导入依赖的package包/类
static public void unzipFile(File destFile, File zipFile) {
	final class Expander extends Expand {
		@SuppressWarnings("deprecation")
		public Expander() {
			project = new Project();
			project.init();
			taskType = "unzip";
			taskName = "unzip";
			target = new Target();
		}
	}

	Expander expander = new Expander();
	expander.setSrc(zipFile);
	expander.setDest(destFile);
	expander.execute();
}
 
开发者ID:AbnerLin,项目名称:PLWeb-Destop-Version,代码行数:18,代码来源:AntTask.java


示例15: delDir

import org.apache.tools.ant.Target; //导入依赖的package包/类
static public void delDir(File dir) {
	final class AntDelete extends Delete {
		@SuppressWarnings("deprecation")
		public AntDelete() {
			project = new Project();
			project.init();
			taskType = "delete";
			taskName = "delete";
			target = new Target();
		}
	}

	AntDelete ant = new AntDelete();
	ant.setDir(dir);
	ant.execute();
}
 
开发者ID:AbnerLin,项目名称:PLWeb-Destop-Version,代码行数:17,代码来源:AntTask.java


示例16: compile

import org.apache.tools.ant.Target; //导入依赖的package包/类
/**
 * Execute the target compile
 * @return true if execution of the task was successful 
 * @throws TargetNotFoundException
 * @throws BuildException
 */
public boolean compile() throws TargetNotFoundException, BuildException {
	Target t = targets.get("compile");
	if (t == null)
		throw new TargetNotFoundException(
				"The target compile was not found in the build file");
	antProject.executeTarget(t.getName());
	return true;
}
 
开发者ID:N0taN3rd,项目名称:Mutation-Testing-Framework,代码行数:15,代码来源:AntRunner.java


示例17: parseUnknownElement

import org.apache.tools.ant.Target; //导入依赖的package包/类
/**
 * Parse an unknown element from a url
 *
 * @param project the current project
 * @param source  the url containing the task
 * @return a configured task
 * @exception BuildException if an error occurs
 */
public UnknownElement parseUnknownElement(Project project, URL source)
    throws BuildException {
    Target dummyTarget = new Target();
    dummyTarget.setProject(project);

    AntXMLContext context = new AntXMLContext(project);
    context.addTarget(dummyTarget);
    context.setImplicitTarget(dummyTarget);

    parse(context.getProject(), source, new RootHandler(context, elementHandler));
    Task[] tasks = dummyTarget.getTasks();
    if (tasks.length != 1) {
        throw new BuildException("No tasks defined");
    }
    return (UnknownElement) tasks[0];
}
 
开发者ID:apache,项目名称:ant,代码行数:25,代码来源:ProjectHelper2.java


示例18: executeTargets

import org.apache.tools.ant.Target; //导入依赖的package包/类
/** {@inheritDoc}. */
public void executeTargets(Project project, String[] targetNames)
    throws BuildException {
    Hashtable<String, Target> targets = project.getTargets();
    BuildException thrownException = null;
    for (int i = 0; i < targetNames.length; i++) {
        try {
            Target t = targets.get(targetNames[i]);
            if (t == null) {
              throw new BuildException("Unknown target " + targetNames[i]);
            }
            t.performTasks();
        } catch (BuildException ex) {
            if (project.isKeepGoingMode()) {
                thrownException = ex;
            } else {
                throw ex;
            }
        }
    }
    if (thrownException != null) {
        throw thrownException;
    }
}
 
开发者ID:apache,项目名称:ant,代码行数:25,代码来源:IgnoreDependenciesExecutor.java


示例19: concatDescriptions

import org.apache.tools.ant.Target; //导入依赖的package包/类
private static void concatDescriptions(Project project, Target t,
                                       StringBuilder description) {
    if (t == null) {
        return;
    }
    for (Task task : findElementInTarget(t, "description")) {
        if (!(task instanceof UnknownElement)) {
            continue;
        }
        UnknownElement ue = ((UnknownElement) task);
        String descComp = ue.getWrapper().getText().toString();
        if (descComp != null) {
            description.append(project.replaceProperties(descComp));
        }
    }
}
 
开发者ID:apache,项目名称:ant,代码行数:17,代码来源:Description.java


示例20: searchTask

import org.apache.tools.ant.Target; //导入依赖的package包/类
public static List searchTask(Class expectedTaskClass, Project project) {
	List result = new ArrayList();
	for (Iterator iterator = project.getTargets().values().iterator(); iterator
			.hasNext();) {
		Target t = (Target) iterator.next();
		for (int i = 0; i < t.getTasks().length; i++) {
			Task task = t.getTasks()[i];
			Class taskClass = ComponentHelper.getComponentHelper(project)
					.getComponentClass(task.getTaskType());
			// will need to see in what cases it could return a null type
			// perhaps failing when the task is using a custom antlib
			// defined task
			if (taskClass != null && taskClass.equals(expectedTaskClass)) {
				result.add(task);
			}
		}
	}
	return result;
}
 
开发者ID:apache,项目名称:ant-easyant-tasks,代码行数:20,代码来源:DebugUtils.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Mongobee类代码示例发布时间:2022-05-21
下一篇:
Java PlayMode类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap