Last updated 04 March 2015
Table of Contents
Heroku supports the deployment of WAR files via Git deployment (which packages the WAR file remotely) and via the Heroku Maven plugin (which packages the WAR file locally). The default server for both methods is Tomcat 7, but the platform provides the flexibility to substitute any bootable or embeddable servlet container, such as Jetty.
This article provides a general overview of the two WAR file deployment methods and discusses the tradeoffs between them.
Deployment with the Heroku Maven Plugin
Deploying a WAR file with the Heroku Maven plugin allows you to integrate the deployment process with your existing Maven process. The Heroku plugin uses the artifacts generate by your
mvn package phase, and builds them into a Slug file that is uploaded to the Heroku servers.
In this way, the Heroku Maven plugin avoids the overhead of recompiling your project remotely. This is often the preferred approach when deploying from a CI server, which may already have built your WAR file and tested it.
Deployment with the Heroku Toolbelt
$ heroku plugins:install https://github.com/heroku/heroku-deploy
And as long as you have a Java runtime installed locally, you can deploy with this command:
$ heroku deploy:war --war <path_to_war_file> --app <app_name>
This tool uses the same underlying code as the Heroku Maven plugin, but without the Maven integration.
Git Deployment with Webapp Runner
Deploying a WAR file by pushing to a Git repository is an easy way to get started with Heroku. It also has the advantage of ensuring Dev/Prod parity. However, the compile phase of Git deployment will execute your Maven goals, which makes it slower than other deployment methods.
A number of older Heroku tools that were used to deploy WAR files may work, but are no longer being actively developed. They include:
While they may continue to work, it is strongly recommended that you upgrade to one of the two approaches described above.
See the Heroku DevCenter articles for more information on deploying from Eclipse, IntelliJ or a CI Server.