ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 17973] - A <final> target just like a <init> target
Date Thu, 26 May 2005 17:14:34 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=17973>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=17973


gudnabrsam@yahoo.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |1.6.3




------- Additional Comments From gudnabrsam@yahoo.com  2005-05-26 19:14 -------
In the current version of Ant you can create your own target Executor. Actually,
I've written it for you:

import org.apache.tools.ant.Project;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.helper.DefaultExecutor;

/**
 * Executor that runs a final target.
 */
public class FinalTargetExecutor extends DefaultExecutor {
    public void executeTargets(Project project, String[] targetNames)
        throws BuildException {
        BuildException be = null;
        try {
            super.executeTargets(project, targetNames);
        } catch (BuildException e) {
            be = e;
        } finally {
            String ft = project.getProperty("finaltarget");
            if (ft != null) {
                try {
                    project.executeTarget(ft);
                } catch (BuildException e) {
                    project.log(e.getMessage());
                }
            }
            if (be != null) {
                throw be;
            }
        }
    }
}

all you have to do is set the property "finaltarget" to whatever target name you
want called.  As usual, this can be set inside the buildfile or overridden from
the command line.  Feel free to modify this to suit your needs.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


Mime
View raw message