ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <DDevie...@lgc.com>
Subject RE: Help! P4Change.execute hangs the process
Date Fri, 05 Mar 2004 22:05:50 GMT
> From: Clifton C. Craig [mailto:ccc@icsaward.com]
> 
> I think I found the problem. I need to call init() on p4change in order
> for it to work. Once I put a call in to init everything seems fine. What
> a pain! I thought project.createTask() did that for you. Oh well. One
> more lump to grow on.

Sorry I didn't understand this was your problem.

Here's how I configure helper tasks within my tasks. --DD

public class JaxbSchemaCompiler
             extends ConditionalAspect.AbstractTask {

    /** The &lt;java&gt; task to run the Jaxb schema compiler. */
    private Java _java;

    // Override Task#init
    public void init()
                throws BuildException {
        _java = new Java();
        TaskUtils.configureTask(this, _java);
    }
...
}

public class TaskUtils {
    /**
     * Configures a helper task to be used within another task.
     *
     * @param  parent the parent (custom) task using the helper task.
     * @param  helper the helper task to configure for use.
     * @return the configured helper task for call chaining.
     */
    public static Task configureTask(Task parent, Task helper) {
        // Make helper share attributes of the parent
        helper.setProject(parent.getProject());
        helper.setTaskName(parent.getTaskName());
        helper.setOwningTarget(parent.getOwningTarget());

        // Initialize (and return) the helper
        helper.init();
        return helper;
    }
...
}

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


Mime
View raw message