October 19, 2011

Groovy Goodness: Default Groovy Script File Extensions

When we run a Groovy script file from the command line with the groovy command we can use the complete filename to refer to the script file. But we can also leave out the filename extension. By default the following extensions are used to search for the Groovy script file:

  • .groovy
  • .gvy
  • .gy
  • .gsh

So suppose we have a Groovy script file named sample.gsh we can use the following commands to run the file:

$ groovy sample.gsh
$ groovy sample

(With this post we hit Groovy Goodness post 250. ;-) )