> I have a build xml with target say 'compile'
> 
> However if the user says 'ant comp' or any other target which does not
> exists, I want to handle them using a my custom code either a 
> macro or a ant
> custom task or groovy. 
> 
> Is this possible, if yes, could you pl. let me know the right 
> place to get
> more info on this.


While this scenario is directly supported it could be achieved using
some hooks:
- the execution of targets is delegated by the org.apache.tools.ant.Main
class
  to an Executor 
 
http://svn.apache.org/repos/asf/ant/core/trunk/src/main/org/apache/tools
/ant/Main.java
  line 775: project.executeTargets(targets);

 
http://svn.apache.org/repos/asf/ant/core/trunk/src/main/org/apache/tools
/ant/Project.java
    public void executeTargets(Vector names) throws BuildException {
        ...
        getExecutor().executeTargets( ... );
    }

   getExecutor() returns an implementation of
org.apache.tools.ant.Executor. The 
   class to return is defined by the property "ant.executor.class".

- you could implement your own executor which works like
    executeTargets(Vector names) {
        List missingTargets = checkTargetExistence(names);
        if (missingTargets.isEmpty()) {
            getExecutorDelegate().executeTargets(names);
        } else {
            handleTargetMissingError(missingTargets);
        }


Jan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org
For additional commands, e-mail: dev-h...@ant.apache.org

Reply via email to