01 November 2007

Ant custom tasks

Ant, the java Make can be extended by creating your own custom task. I had fun today by creating a new Ant Task called SplashTask. It generates an new logo on the fly to be used as a java splashScreen.

Declaration:


(...) <taskdef name="makeSplash"
classname="org.lindenb.ant.SplashTask"
classpath="build/ant"/>
(...)
<target name="splash" depends="compile-ant-tasks">
<makeSplash title="Hello World !" file="task.jpeg"/>
</target>
(...)


Usage:

pierre@linux:~/lindenb> ant x
Buildfile: build.xml

compile-ant-tasks:

splash:
[makeSplash] Saved SplashScreen "Hello World !" to task.jpeg[349 x 85]



task

The source code is available at http://lindenb.googlecode.com/svn/trunk/src/java/org/lindenb/ant/SplashTask.java


Pierre

No comments:

Post a Comment