The task shown [above] must somehow get called by Phing. Therefore it must be made available to Phing so that the buildfile parser is aware a correlating XML element and it's parameters. Have a look at the minimalistic buildfile example given in [the buildfile below] that does exactly this.
<?xml version="1.0" ?> <project name="test" basedir="." default="test.myecho"> <taskdef name="myecho" classname="phing.tasks.my.MyEchoTask" /> <target name="test.myecho"> <myecho message="Hello World" /> </target> </project>
Besides the XML document prolog and the shell elements that are required to
properly execute the task (project, target) you'll find the
<taskdef>
element (line 4) that properly registers your
custom task to Phing. For a detailed synopsis of the taskdef element see the
[description of this task].
Now, as we have registered the task by assigning a name and the worker class
([see source code above]) it is ready for usage within the
<target>
context (line 8). You see that we pass the
message that our task should echo to the screen via an XML attribute called
"message".