If you are deploying to a traditional container (Tomcat, Jetty etc.) you can create a Web Application Archive (WAR file), and Grails includes the command for performing this task:
This will produce a WAR file under the directory which can then be deployed as per your container’s instructions.
If you are building a WAR file to deploy on Tomcat 7 then in addition you will need to change the target Tomcat version in the build. Grails is built against Tomcat 8 APIs by default.To target a Tomcat 7 container, insert a line to above the dependencies { }
section:
Unlike most scripts which default to the development
environment unless overridden, the war
command runs in the environment by default. You can override this like any script by specifying the environment name, for example:
When deploying Grails you should always run your containers JVM with the -server
option and with sufficient memory allocation. A good set of VM flags would be: