Most Grails application are intended to deploy within external container. According to the traditional way of deployment, the apps are bundled as war packaging, deploy it into any external container like tomcat and Jetty.
There is a plugin Standalone App Runner which allow to em-bade a container inside the grails application itself. The advantage of that is that a Gails application can be run as a standalone application , without any dependency of external container.
The embadded container comes up with application up and stop when we stop the application. To use this add the plugin dependencies in BuildConfig.groovy
To create the Jar file with embadded container :
To Run the Jar file as a stand alone application :
java -jar /path/to/jar_name.jar
We can also pass the environment variables while running the jar to run the container with a specific environment configuration :
grails -Dgrails.env=prod build-standalone jar_name.jar
This plugin has both Tomcat and Jetty container functionality, we can set the jetty as a default container. For that we need to specify that in BuildConfig.groovy :
grails.plugin.standalone.useJetty = true
Also it can bs specify at the time of deployment which server will be used to run the application. we can specify the flag values for perticular container.
grails build-standalone --tomcat grails build-standalone --jetty
It removes the external container dependency and easily integrate with the application. And the Grails application can be run as standalone application with Jar packaging.
Hope this helps