In Grails we can add aliases for standard Grails commands with the alias command. For example we want to use another name for a command or combine a command with arguments to a single alias. With the following command we create a start-app alias for the standard run-app command:

$ grails alias start-app run-app
Alias start-app with value run-app configured

Now we can invoke $ grails start-app as an alternative for run-app. All aliases are stored in the file userHome/.grails/.aliases. This means the aliases we create are available for all Grails versions and applications of the current user. It is also good to notice than command arguments that start with - or -- are not saved as part of an alias. But for example the unit: argument for test-app can be part of an alias:

$ grails alias unitTest test-app unit:
Alias unitTest with value test-app unit: configured

We can even specify test class patterns to be part of the alias. We then invoke the new alias with extra arguments -echoOut and -echoErr:

$ grails alias test-controllers test-app unit: *Controller
Alias test-controllers with value test-app unit: *Controller configured
$ grails test-controllers -echoOut -echoErr

To delete an alias we can remove it from the file userHome/.grails/.aliases or use $ grails alias --delete=_alias_.

We can see which aliases are defined with the --list argument:

$ grails alias --list
test-controllers = test-app unit: *Controller
start-app = run-app
unitTest = test-app unit:

Code written with Grails 2.3.8.

Original article