22.2 Container Deployment (e.g. Tomcat) 3.1.7

See the light - agile, industrial strength, rapid web application development made easy

(Quick Reference) # 22.2 Container Deployment (e.g. Tomcat) - Reference Documentation Authors: Graeme Rocher, Peter Ledbrook, Marc Palmer, Jeff Brown, Luke Daley, Burt Beckwith, Lari Hotari Version: 3.1.7 ## 22.2 Container Deployment (e.g. Tomcat) Grails apps can be deployed to a Servlet Container or Application Server. ### WAR file A common approach to Grails application deployment in production is to deploy to an existing Servlet container via a WAR file. Containers allow multiple applications to be deployed on the same port with different paths. Creating a WAR file is as simple as executing the war command:
    grails war
This will produce a WAR file that can be deployed to a container, in the `build/libs` directory. Note that by default Grails will include an embeddable version of Tomcat inside the WAR file so that it is runnable (see the previous section), this can cause problems if you deploy to a different version of Tomcat. If you don't intend to use the embedded container then you should change the scope of the Tomcat dependencies to `provided` prior to deploying to your production container in `build.gradle`:
    provided "org.springframework.boot:spring-boot-starter-tomcat"
## Application servers Ideally you should be able to simply drop a WAR file created by Grails into any application server and it should work straight away. However, things are rarely ever this simple. The Grails website contains a list of application servers that Grails has been tested with, along with any additional steps required to get a Grails WAR file working. | Quick Reference (hide)