Plugins You can find out about all the publicly available Grails plugins.

Tomcat application bundler plugin

  • Tags: /
  • Latest: 0.0.3
  • Last Updated: 02 May 2012
  • Grails version: 2.0 > *
1 vote
build "org.grails.plugins:tomcat-bundler:0.0.3"

 Documentation  Source  Issues


A plugin to simplify bundling application with Tomcat to create a whole package to be used by hosting



The plugin provides just one additional script: bundle

grails bundle

If you have just installed this plugin you'll have to refresh the project dependencies. You can do that by invoking the compile phase like this:
grails compile

That'll do everything there is to create a zip with Tomcat and the application in it.


By default this plugin uses Tomcat 7.0.25 from mirror and uses ${appName}-${appVersion}.zip for the final archive name. This can all be changed in the Config.groovy file as follows:

grails.deployment.file = "" // name of the final archive to create
grails.deployment.tomcat.version = "7.0.25" // Tomcat version
grails.deployment.tomcat.url = "url-to-tomcat-archive" // full URL where Tomcat should be downloaded from

Changing Tomcat version

A common thing is to use Tomcat 6 instead of Tomcat 7 which is the plugin's default. To do so enter the following configuration options in your Config.groovy:

grails.deployment.tomcat.version = "6.0.35"
grails.deployment.tomcat.url = ""

Tomcat setup

Even though Tomcat is pretty much pre-configured by default there are some changes made by the bundle script to make it more usable in the context of a Grails application.

Added conf folder to classpath

In order to be able to externalize configuration of the application and to keep it inside the Tomcat's conf folder the bundle script modifies the file to add the ${catalina.base}/conf folder to shared.loader item. This way when you enable externalized configuration in Config.groovy like this:

grails.config.locations = [ "classpath:${appName}-config.groovy" ]

You'll be able to enter all the application's properties in that file and have them override the defaults from other configuration files.

Copying custom files to final bundle.

In the event one would like to have extra resources copied to wherever in the resulting file there is a folder named "deployment" having the following structure:

  + common
  + development
  + test
  + production

The common subfolder contains all the files that should be copied regardles of the environment. The rest of the folders should contain files for specific environments. For example if you're building the production deployment bundle you'd execute

...> grails prod bundle

and the actual environment will be "production". It works even with custom environments - you just need to name the folder properly.

Those source folders will be created if they don't exists so you can simply fill in the content as you need


2012.02.28: Version 0.0.2

  • Added ability to copy arbitrary files to resulting application archive

2012.02.15: Version 0.0.1

  • Initial release