Running Grails application and managing its dependencies with maven is quite easy. You just need to issue the following command for generating the pom.xml. And then you can manage your Grails application’s dependencies with maven:

grails create-pom my.company

This will generate the pom file with all the dependencies and maven grails plugin. In order to run the application with maven you will have to issue the following command:

mvn grails:run-app

to explore more goals offered by the Grails maven plugin use the following command to list them:

mvn grails:help

This will list all the goals offered by the plugin. Here’s the list provided by Grails 2.1.3:

This plugin has 37 goals:

grails:clean
Cleans a Grails project.

grails:config-directories
Set sources/tests directories to be compatible with the directories layout
used by grails.

grails:console
Runs a Grails console inside the current project.

grails:create-controller
Creates a new controller.

grails:create-domain-class
Creates a new domain class.

grails:create-integration-test
Creates a new Grails integration test which loads the whole Grails environment
when run.

grails:create-pom
Creates a creates a maven 2 POM for an existing Grails project.

grails:create-script
Creates a Grails Gant Script.

grails:create-service
Creates a new service class.

grails:create-tag-lib
Creates a new GSP tag library.

grails:create-unit-test
Creates a new Grails unit test. A unit test requires that you mock out access
to dynamic methods, but executes a lot quicker.

grails:exec
Executes an arbitrary Grails command.

grails:generate-all
Generates a CRUD interface (controller + views) for a domain class.

grails:generate-controller
Generates a CRUD controller for a specified domain class.

grails:generate-views
Generates the CRUD views for a specified domain class.

grails:help
Display help information on grails-maven-plugin.
Call
mvn grails:help -Ddetail=true -Dgoal=<goal-name>
to display parameter details.

grails:init
Validate consistency between Grails and Maven settings.

grails:init-plugin
Validate consistency between Grails and Maven settings.

grails:install-templates
Installs the artifact and scaffolding templates.

grails:list-plugins
Lists the available plugins.

grails:maven-clean
Cleans a Grails project and jars in lib directory.

grails:maven-compile
Compiles a Grails project.

grails:maven-functional-test
Runs a Grails application's functional tests.

grails:maven-grails-app-war
Creates a WAR archive and register it in maven. This differs from the
MvnWarMojo in that it makes the WAR file the build artifact for the
'grails-app' packaging. The standard 'maven-war' goal is designed for the
normal 'war' packaging.

grails:maven-test
Runs a Grails applications unit tests and integration tests.

grails:maven-war
Creates a WAR archive for the project and puts it in the usual Maven place.

grails:package
Packages the Grails application into the web-app folder for running.

grails:package-plugin
Packages the Grails plugin.

grails:run-app
Runs a Grails application in Jetty.

grails:run-app-https
Runs a Grails application in Jetty with HTTPS listener.

grails:run-war
Runs a Grails application in Jetty from its WAR.

grails:set-version
Set the grails application version from the Maven POM version.

grails:test-app
Runs a Grails applications unit tests and integration tests.

grails:upgrade
Upgrades a Grails application to the version of this plugin.

grails:validate
Validate consistency between Grails and Maven settings.

grails:validate-plugin
Validate consistency between Grails and Maven settings.

grails:war
Creates a WAR archive.