Nick Carroll

Metabolising caffeine into code

One click deployment with Maven and Bamboo

without comments

A while back I wrote about achieving continuous deployment with one-click deployments. I didn’t provide an example for that post as I mostly wrote about why you need to achieve continuous deployment. Here I will follow up with a simple example of how you can achieve continuous deployment.

Continuous deployment is quite easy to setup if you are using a typical Maven project structure and Bamboo as your continuous integration tool. Also I am assuming that you want to deploy your application to a tomcat server.

In your pom.xml file add the following configuration so that you use the Tomcat plugin for deploying your application to http://hostname.com/app. Change the path, url, and server configurations to suit your needs.


    


                org.codehaus.mojo
                tomcat-maven-plugin
                
/app
                    http://hostname.com/manager
                    deployment.server
                
            
        
    

Also make sure that your .m2/settings.xml file contains the following for authenticating with the Tomcat manager.


  
    
      deployment.server
      tomcat
password
    
  

In Bamboo create a new pan for your project. I tend to give this plan the name “Promote to Production”. Configure the Builder goal for Maven to run clean tomcat:redeploy. I also only allow a specific user to trigger this plan so that not everyone has permission to deploy into production. Finally, configure the build strategy to run manually, so an authorised person can click on the Build plan button in Bamboo to deploy the application.

Once set up the above instructions will allow an authorised person in Bamboo to click on a single button to deploy into production. Leveraging your continuous integration tool for deployment allows you to archive deployment artifacts such as your WAR files in the case where you have to revert to a previous version.

Written by Nick

February 26th, 2010 at 1:00 pm

Posted in Programming

Tagged with

Leave a Reply