Tuesday, 14 April 2009

Ant script for renaming Java files to Groovy

At the moment I am starting to study Groovy, which is an alternative language (to Java itself) that can be used on the Java Platform.

It's main advantage (over Java) is its "expressiveness", meaning that the same program can be written using less instructions, hence theoretically increasing productivity. In that regard it is quite similar to Smalltalk.

Groovy is a superset of the Java language. This means that any Java program is by default also a Groovy program (the opposite not being necessarily true). I created a very simple Ant file that enables me to convert all my .java files to .groovy (and back again):

<project name="Groovy" basedir="." default="javaToGroovy">

<target description="Changes Java file names to Groovy" name="javaToGroovy">
<move todir="" file="src">
<mapper type="glob" to="*.groovy" from="*.java">
</move>
</target>

<target description="Changes Groovy file names to Java" name="groovyToJava">
<move todir="" file="src">
<mapper type="glob" to="*.java" from="*.groovy">
</move>
</target>

</project>

Please bookmark, your votes are noticed and appreciated:
Bookmark and Share

5 comments:

  1. So is this a file renamer? Remeber that not ALL Java is Groovy compatible, but I guess 99% is.

    ReplyDelete
  2. For resolving Gmail error “filename not specified” it is advisable to get the antivirus software disabled as the software sometimes gets the user into some or the other type of conflict. If you are still looking for help then you should get connected with the experts at Gmail support UK . There is no such issue that cannot be resolved by the Gmail technicians.
    Contact No.: +44-800-368-9067
    Website: http://www.email-helpline-number.co.uk/
    Other Source: http://www.gmailhelpline.co.uk/
    Face book: https://www.facebook.com/gmailhelpline/
    Instagram: https://www.instagram.com/gmailhelplinesupport/
    Twitter: https://twitter.com/Gmailhelpline24
    Address: United Kingdom

    ReplyDelete
  3. I haven’t any word to appreciate this post…..Really i am impressed from this post….the person who create this post it was a great human..thanks for shared this with us 경마

    ReplyDelete
  4. Thanks for picking out the time to discuss this, I feel great about it and love studying more on this topic. It is extremely helpful for me. Thanks for such a valuable help again. 메이저사이트

    ReplyDelete