You can use Bamboo to deploy and manage your Java web application with Tomcat 6 or 7, without having to directly interact with Maven, Ant or write special scripts.
Bamboo provides tasks that use the HTTP-based scripting interface to the Tomcat Manager application that ships with Tomcat. You can use the Bamboo tasks to perform the following Tomcat operations:
- Deploy an application to a Tomcat instance
- Start an application in a Tomcat instance
- Stop an application in a Tomcat instance
- Reload an application to a Tomcat instance
- Undeploy an application from a Tomcat instance
Each of these tasks run as part of a Bamboo job.
On this page :
Related pages:
Atlassian blogs:
Setting up Tomcat
You will need to prepare the Tomcat server before Bamboo can manage and deploy applications to it.
Download the Tomcat 7 distribution and unzip it on your file system.
Add a new Tomcat user for Bamboo to use the Tomcat Application Manager by adding the following line in
conf/tomcat-users.xmlbetween the<tomcat-users>tags:<user username="bamboo" password="bamboo" roles="manager-script,manager-gui"/>
- Start Tomcat by running
bin/startup.shon Linux or Mac, orbin/startup.baton Windows. - Test this setup by browsing to http://localhost:8080/manager and using the username and password you configured in the step above. You should see the “Tomcat Web Application Manager” page, and a list of the running applications on your instance.
Deploying an application from Bamboo
You use Tomcat deployment tasks in the context of a job in a build plan in Bamboo. This plan should generate a deployable artifact, such as a WAR file. To deploy the artifact, you add a Tomcat deploy task to the plan, as follows:
- Navigate to the task configuration for the job (this will be the default job if you are creating a new plan).
- Click Add Task and then Deploy Tomcat Application.
Configure the Tomcat task settings, as described below.
Click Save.
To deploy the application, simply run the plan.
You can check that the deployment has been successful by:
Navigating to the logs for the job. Towards the end you should see something like:
> Deploying application with war file ‘target/tomcat-test-0.1.war’ to context ‘/myapp’ to server [http://localhost:8080/manager/](http://localhost:8080/manager/) > Application was successfully deployed.
This indicates that Bamboo completed the task successfully.
Now, browse to the expected address for your application. You should see the welcome page.
Configuring the Tomcat tasks
The Tomcat Deploy, Start, Stop, Undeploy and Reload tasks each make use of some or all of the following configuration settings:
| Task Description | To help you to identify the task. |
| Disable this task | Check, or clear, to selectively run this task. |
| Tomcat Manager URL | The URL for the Tomcat Manager e.g. http://localhost:8080/manager/ |
| Target Tomcat server is version 6.x | Choose this if deploying to a Tomcat 6.x server. |
Tomcat Manager Username and Password | These should match the credentials set in conf/tomcat-users.xml when you configured Tomcat, as described above. |
| Application Context | Specifies where the application should sit on the Tomcat server once deployed. |
| WAR File | The path to the WAR file, relative to the Bamboo working directory, for example “target/tomcat-test-0.1.war” |
| Deployment Tag | The value used to tag the deployment within the Tomcat Manager. You can use Bamboo variables to build the tag value. For example, using the value ${bamboo.buildResultKey} will tag the deployment with the build number of the build that was used to deploy the application. |

9 Comments
Loreno Oliveira
Jul 17, 2013Is Bamboo able to start/stop the tomcat instance? If an instance is launched and several deployments are made, this running instance will end up broken due to permgen failure and a manual action will be necessary to restart tomcat...
James Dumay
Nov 03, 2013You would need to do this with either a Troubleshooting SSH issues or Script task.
Jamie
Nov 01, 2013The path to the WAR file, relative to the Bamboo working directory, for example “target/tomcat-test-0.1.war”
What do you put in this box if the name of the WAR file is dynamic? Our WAR file has the repository revision number appended to the end of it. I tried using target/*.war but Bamboo complains it can't find the file.
James Dumay
Nov 03, 2013Using *.war won't work as it could match multiple war files in the working directory.
To work around this, you can use Bamboo variables in the WAR file field to recreate its exact name. For example:
${bamboo.myWarsVersion}-${bamboo.repository.revision.number}.warpat-humphreys
Dec 13, 2013Is it possible to deploy a war to multiple Tomcat 7 instances?
ArmenA
Dec 13, 2013You can add and configure as many Deploy Tomcat Application tasks as you need and deploy to many Tomcat instances.
paul blakeley
Jan 10, 2014Is it possible to configure bamboo to point to a war from an absolute path rather than a relative one?
ArmenA
Jan 10, 2014No, you have to specify a relative path. If your war file is not somewhere in the working directory, you can use two dots in the path (../../) to navigate to parent directories.
kjordan2001
Mar 19, 2014Would it be possible to set the undeploy task as no fail? This happens if you don't have an application at that context, but that shouldn't really be fatal since there's probably a deploy after that. In my case I do a server restart after the undeploy to clear out the Tomcat class loaders so there's no residual leftover from the previous deployment.