This post originated from an RSS feed registered with Java Buzz
by dion.
Original Post: Add Groovy to your build env for fun :)
Feed Title: techno.blog(Dion)
Feed URL: http://feeds.feedburner.com/dion
Feed Description: blogging about life the universe and everything tech
One of the great things about groovy is that you can sneak it into your development :)
So, go on, go to a project and tweak the build.xml to add groovyc into your compile step.
1. Add the ant task definition
<taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc" classpathref="project.class.path" />
2. Go to one of your compile tasks and add a groovyc to do its thing (as well as the javac)
<target name="compile-tests" depends="prepare">
<javac srcdir="${src.tests.dir}"
destdir="${build.tests.dir}"
debug="off"
deprecation="off"
optimize="on"
includeAntRuntime="no">
<classpath refid="project.common.class.path"/>
</javac>
<groovyc srcdir="${src.tests.dir}" destdir="${build.tests.dir}">
<classpath refid="project.common.class.path"/>
</groovyc>
</target>
3. Repeat for any compile tasks that you want to make groovy
4. Now, if you fancy, make a Foo.groovy instead of a Foo.java and away you go!