I have read this article and used it to write my first Ant task called AutoTestTask
:
public class AutoTestTask extends org.apache.tools.ant.Task {
// ...
}
I have also compiled and packaged this object into auto-test.jar
.
If my understanding of Ant is correct, then to include it as part of another project's build, I use the following XML:
<project name="SomeProject" basedir="." default="deploy" xmlns:at="antlib:org.me.auto-test">
<!-- Task definitions. -->
<taskdef name="at-autotest" classname="org.me.auto-test.AutoTestTask"/>
<!-- Use the task. -->
<at:autotest/>
</project>
I believe I also need to copy auto-test.jar
into my ${ANT_HOME}/lib directory - can someone please confirm? What's confusing me is the xmlns:at="antlib:org.me.auto-test"
attribute at the top of the XML, and specifically, the antlib:<whatever>
portion. Is this some kind of Ant-specific protocol that says "*anything qualified by the at
namespace will be found inside ${ANT_HOME}/lib with a root package of org.me.auto-test
*"? If not could someone explain what it means?
Also, if I'm missing anything obvious or have anything configured incorrectly, please let me know. Thanks in advance!