Understanding Grails Aliases

Post by Matt Nohr

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.


The biggest disappointment was that you can’t use ‘-’ or ‘–’ switches/parameters. So I cannot do something like:

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.


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.

This entry was posted in Agile Processes, Software Development and tagged . Bookmark the permalink.

Related Posts:

7 Responses to Understanding Grails Aliases

  1. Bobby Warner says:

    Good post. Just a quick change, it creates the aliases file in not . Thanks, Bobby

  2. Bobby Warner says:

    Looks like it escaped my less-than and greater-than. Just was saying it should be GRAILS_HOME not GROOVY_HOME. Thanks, Bobby

  3. robert says:

    I don’t use grails, but you could try editing the grails_home/.aliases to have the command line switches.

  4. Matt Nohr says:

    Bobby – Good catch. I updated the post to say GRAILS_HOME instead of GROOVY_HOME

  5. Matt Nohr says:

    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 -coverage

    But 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.”

  6. Pingback: An Army of Solipsists » Blog Archive » This Week in Grails (2012-26)

  7. Pingback: Questa settimana in Grails (2012-26) - luca-canducci.com - Il blog di Luca Canducci: notizie, tips e nuove tecnologie dal mondo dell’IT.

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>