Monthly Archives: March 2014

Crucial piece of puzzle when developing web application is Continuous Delivery. Testers or users can by early access to alpha version contribute to development process. Design, requirements, architecture or performance problems can be catched much sooner.

I am going to show how to set up this process with usage of Maven and Jenkins. Target environment is hosted on Tomcat7. Source code is hosted on GitHub. Because I am type of developer that tries to avoid polling as much as possible, I am going to show how to trigger this process by GitHub’s cool feature called WebHooks.

1. Create Continuous Delivery job

Creation of Jenkins job and integrating it with Maven is very easy. Will quickly cover this:

Create it with “New Item” -> “Build a maven2/3 project“

Set up GitHub URL in section “Source Code Management” (Authentication is not needed in my case, because my GitHub repository is public)

Skip section “Build Triggers” for now, will come back to this later.

Configure “Build” section with POM path and goals you are using for building your WAR file

Set up “Build Settings” -> “E-Mail Notification”

Save and try to run the Jenkins job. This is very common and basic Jenkins job configuration. Now we are about to set up deployment of WAR file into Tomcat7. But here comes dilemma into play. There are two very mature ways for deployment. I will cover both and let reader pick one.

a) Continuous Delivery with usage of tomcat7-maven-plugin

First of all we need to enable access into Tomcat7. Edit $CATALINA_HOME/conf/tomcat-users.xml (CATALINA_HOME is Tomcat’s home directory) and configure role and user as follows

2. Jenkins – GitHub integration

Generate Personal access token in GitHub for Jenkins. This can be found under “Edit Your Profile” -> “Applications”

Set up GitHub plugin to use generated token in Jenkins. You can find this section in “Manage Jenkins” -> “Configure System” -> “GitHub Web Hook”. Note that you don’t need to use password. API URL is “https://api.github.com”