5.5.2 Working with Gradle Tasks

As mentioned previously the grails command uses an embedded version of Gradle and certain Grails commands that existed in previous versions of Grails map onto their Gradle equivalents. The following table shows which Grails command invoke which Gradle task:

Grails CommandGradle Task
cleanclean
compileclasses
packageassemble
run-appbootRun
test-apptest
test-app —integrationintegrationTest
warassemble

You can invoke any of these Grails commands using their Gradle equivalents if you prefer:

  1. $ gradle test

Note however that you will need to use a version of Gradle compatible with Grails 3.1 (Gradle 2.2 or above). If you wish to invoke a Gradle task using the version of Gradle used by Grails you can do so with the grails command:

  1. $ grails gradle compileGroovy

However, it is recommended you do this via interactive mode, as it greatly speeds up execution and provides TAB completion for the available Gradle tasks:

  1. $ grails
  2. | Enter a command name to run. Use TAB for completion:
  3. grails> gradle compileGroovy
  4. ...

To find out what Gradle tasks are available without using interactive mode TAB completion you can use the Gradle tasks task:

  1. gradle tasks