Wednesday, 22 May 2013

Using Jenkin's to perform Build and Deploy for our custom Portlet : Setup Continuous Integration

In the last article we saw the steps to create a new JSR 286 Portlet from Scratch.

Now every time we make some change we need to build our project and then deploy it.
How cool it will be if these steps can be taken care of by click of a button.
Automation of such tasks can not just save time but also make us more efficient.

Below is a set of steps which can be used to setup Jenkins and then build Project using that. Its really simple. Jenkins is a Continuous Integration tool for automation of build, test and deploy.

1. Download Jenkins WAR file from
2. Put this in the webapps folder in the tomcat. In the last article we have seen how to download Liferay Tomcat bundle.
3. Start the server and go to localhost:8080/jenkins
4. One extra step is needed if you want to enable security in Jenkins. Open the tomcat-users.xml file which is in the /conf location. And add the following lines:

<role rolename="admin" />
<user username="jenkins-admin" password="admin" roles="admin" />

In order to enable security now go to Configure Global Security from the Jenkins Dashboard -> Manage Jenkins
5. Lets now try to add our Project. From the dashboard click on New Job.
6. Since we have a Maven Project select the option "Build a maven2/3 project". Also give a name like "FirstProject".
7. On the next page go to Build and in the Root POM enter the full path of the Project POM file. Example C:\development\workspace\custom\FirstPortlet\pom.xml. Also in Goals and Options give "clean install" for now. You can later add the deploy option too.
8. Save the changes. From the dashboard itself you can now Build the project. No need to perform a set of steps ay more.

Hope this helps your Project. In the next article I will try to address Automated testing also.

No comments:

Post a Comment