Class AntRunner

java.lang.Object
de.tsl2.nano.execution.AntRunner

public class AntRunner extends Object
is able to run ant targets given by name and properties. If task is a MatchingTask, an array of FileSet can be given.

please have a look at the setter methods of the task to evaluate the properties to set. the properties are case sensitive.
if use the task 'Expand', the class org.apache.tools.ant.taskdefs.Expand will be loaded and instantiated. you must set the property 'destFile' with java.io.File. the AntRunner will call Expand.setDestFile(File).

see @link{http://ant.apache.org/manual} for a list of standard ant tasks.

short list of tasks:
Ant AntCall ANTLR AntStructure AntVersion Apply/ExecOn Apt Attrib Augment Available Basename Bindtargets BuildNumber BUnzip2 BZip2 Cab Continuus/Synergy Tasks CvsChangeLog Checksum Chgrp Chmod Chown Clearcase Tasks Componentdef Concat Condition Supported conditions Copy Copydir Copyfile Cvs CVSPass CvsTagDiff CvsVersion Defaultexcludes Delete Deltree Depend Dependset Diagnostics Dirname Ear Echo Echoproperties EchoXML EJB Tasks Exec Fail Filter FixCRLF FTP GenKey Get GUnzip GZip Hostinfo Image Import Include Input Jar Jarlib-available Jarlib-display Jarlib-manifest Jarlib-resolve Java Javac JavaCC Javadoc/Javadoc2 Javah JDepend JJDoc JJTree Jlink JspC JUnit JUnitReport Length LoadFile LoadProperties LoadResource Local MacroDef Mail MakeURL Manifest ManifestClassPath MimeMail Mkdir Move Native2Ascii NetRexxC Nice Parallel Patch PathConvert Perforce Tasks PreSetDef ProjectHelper Property PropertyFile PropertyHelper Pvcs Record Rename RenameExtensions Replace ReplaceRegExp ResourceCount Retry RExec Rmic Rpm SchemaValidate Scp Script Scriptdef Sequential ServerDeploy Setproxy SignJar Sleep SourceOffSite Sound Splash Sql Sshexec Sshsession Subant Symlink Sync Tar Taskdef Telnet Tempfile Touch Translate Truncate TStamp Typedef Unjar Untar Unwar Unzip Uptodate Microsoft Visual SourceSafe Tasks Waitfor War WhichResource Weblogic JSP Compiler XmlProperty XmlValidate XSLT/Style Zip

Version:
$Revision$
Author:
Thomas Schneider
  • Field Details

  • Constructor Details

    • AntRunner

      public AntRunner()
  • Method Details

    • runTask

      public static void runTask(String name, Properties taskProperties, String fileSetExpression)
      delegates to runTask(String, Map, FileSet...) using createFileSets(String) to create the FileSets.
    • runTask

      public static void runTask(String name, Map taskProperties, org.apache.tools.ant.types.FileSet... fileSets)
      starts the task by name using its properties and perhaps some filesets.

      See here for an overview of ants standard tasks.

       Example:
         FileSet[] fileSets = AntRunner.createFileSets("./:{**\*.*ml}**\*.xml;" + basedir.getPath() + ":{*.txt}");
         Properties props = new Properties();
         props.put("destFile", new File(destFile));
         AntRunner.runTask("Jar", props, fileSets);
       
      Parameters:
      name - task name
      taskProperties - task properties
      fileSets - optional filesets (depends on the task!)
    • createLogfileBuildListener

      public static org.apache.tools.ant.BuildListener createLogfileBuildListener()
      create System.out build listener
      Returns:
      ant build listener
    • createPipedAntBuildListener

      public static org.apache.tools.ant.BuildListener createPipedAntBuildListener(PipedOutputStream pipedOutputStream)
      createPipedBuildListener
      Parameters:
      pipedOutputStream - stream to be connected to a PipedInputStream.
      Returns:
      ant build listener
    • createBuildListener

      public static org.apache.tools.ant.BuildListener createBuildListener(PrintStream out, PrintStream err)
    • createMessageListener

      public static org.apache.tools.ant.BuildListener createMessageListener()
    • createFileSets

      public static org.apache.tools.ant.types.FileSet[] createFileSets(String expression)
      <directory-name>[:{[include][,...]]}[[exclude][,...]];...
      Parameters:
      expression -
      Returns:
    • runRegexReplace

      public static void runRegexReplace(String match, String replace, String dir, String includes)
      convenience to run task TASK_REPLACE_REGEXP
      Parameters:
      match -
      replace -
      dir -
      includes -