In Grails 2.1 (RC2 available at time of writing), Grails introduced a new “alias” command. Like the rest of Grails, there is good high-level documentation for this command. However, here are a few more details.
Quick Overview
You can use aliases to shorten long grails commands. For example, instead of typing this long command every time:
grails test-app integration:spock
You could create an alias one time like this (tis = “test integration spock”):
grails alias tis test-app integration:spock
And then just use the “tis” alias:
grails tis
Check out the documentation for details on how to list (grails alias –list) and delete (grails alias –delete=tis) aliases.
Limitations
The biggest disappointment was that you can’t use ‘-’ or ‘–’ switches/parameters. So I cannot do something like:
DOES NOT WORK grails alias tis test-app integration:spock -coverage
Any command-line switches like “-coverage” are applied to the alias command. However, you could do this with the original “tis” which is better than nothing:
grails tis -coverage
Under the Covers
If interested, there is a file in called <grails_home>/.aliases that contains the list of aliases. This master list applies to all grails projects and all versions of grails. However, you cannot run the alias command outside of a grails project, which I think is strange.
Conclusion
While this has potential to be useful, it is nothing that I can’t do already, and with more power, using “alias” on Mac/Linux or something like “doskey” on Windows. Since this is the first iteration, it will be interesting to see how this evolves.

Good post. Just a quick change, it creates the aliases file in not . Thanks, Bobby
Looks like it escaped my less-than and greater-than. Just was saying it should be GRAILS_HOME not GROOVY_HOME. Thanks, Bobby
I don’t use grails, but you could try editing the grails_home/.aliases to have the command line switches.
Bobby – Good catch. I updated the post to say GRAILS_HOME instead of GROOVY_HOME
Robert – I did try to update the .aliases file directly, but that did not seem to work. I updated the entry to look like this:
tis=test-app integration:spock -coverageBut still got the same result. I also tried putting the quotes around it but that did not work either. It appears the Grails/Groovy script that actually runs is not handing either case correctly. At least not what I consider “correct.”
Pingback: An Army of Solipsists » Blog Archive » This Week in Grails (2012-26)
Pingback: Questa settimana in Grails (2012-26) - luca-canducci.com - Il blog di Luca Canducci: notizie, tips e nuove tecnologie dal mondo dell’IT.