The TypedefTask
provides a way to "declare" your type so that
you can use it in your build file. Here is how you would use this type in order to
define a single DSN and use it for multiple tasks. (Of course you could specify the
DSN connection parameters each time, but the premise behind needing a DSN datatype
was to avoid specifying the connection parameters for each task.)
<?xml version="1.0" ?> <project name="test" basedir="."> <typedef name="dsn" classname="myapp.types.DSN" /> <dsn id="maindsn" url="mysql://localhost/mydatabase" username="root" password="" persistent="false" /> <target name="main"> <my-special-db-task> <dsn refid="maindsn"/> </my-special-db-task> <my-other-db-task> <dsn refid="maindsn"/> </my-other-db-task> </target> </project>