ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <>
Subject AW: Setter in my own Anttask
Date Fri, 12 Feb 2010 06:38:33 GMT
>I analyse a DOPE_task written for our project.
>In one of the setters an application is started.
>I have other setters that must start before this setter, 
>because they have some attributes für the application.
>In what sequence the setters are executed?

IMHO not a good idea ... 
What if the application is required for two attributes? Do you start them twice? 

>I guess in the sewuence I wrote them into ma call inside my Antfile.

Not sure if there is a guaranteed sequence ... order from the buildfile sounds reasonable
as this should be the order a parser works. But in Ant there is a step between strict xml
parsing and the real objects: UnknownObject and its transformation into real objects. 

>(I dont think this was a good idea to strat an application in 
>a setter that needs more than one attribute.
>If possible I will change this...)

In my own tasks I have three phases:
1. build the datastructure (attributes, nested elements, text)
2. check precondition (could use oata.TaskConfigurationChecker)
3. execution

I would try to start the application in step#3


    public void execute() throws BuildException {

    protected void checkConfiguration() throws BuildException {
        TaskConfigurationChecker checker = new TaskConfigurationChecker(this);
            srcdir != null,
            "Attribute 'srcdir' must be set.
            "Srcdir (" + srcdir + ") must exist."
        if (someComplexCondition()) {
            fail("Complex condition failed.");

    protected void doExecute() throws BuildException {
        try {
            if (attributeA != null || attributeB != null) {
        } catch (Exception e) {
            throw new BuildException(e, getLocation());

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message