In this blog we will be learning how to use Continuous Integration tools to deploy Projects, Here I will be using Jenkins as CI and Maven as build tool to deploy Spring MVN Based Applications. STEP 1: You can Install Jenkins through yum/apt-get for your Linux/Redhat Distributions, but I prefer to install jenkins as a home user so that it can access my tools like java,maven,capistrano,ruby,pscp and many different tools. My Home directory here is /home/rails Jenkins will be installed under /home/rails/.jenkins To do this I will download the Jenkins.war file from jenkins repo STEP 2 : Execute the war file using this command
java -jar jenkins.war --httpPort=8080You will view the following lines
Nov 05, 2015 1:14:43 AM hudson.WebAppMain$3 run INFO: Jenkins is fully up and running Access Jenkins through localhost:8080 You should View a Wonderful Jenkins Dashboard.STEP 3 : Create a User who can create jobs and build those, Let me make it easier for you: •Click on Manage Jenkins => Configure Global Security •Enable Security => Jenkins Own user Database. •Under Authorization part, select Matrix based Security, For Anonymous User Under View select only Read Permission •Now Click on Add and create a user named Admin and Grant All Access •Click Save and Apply •You will be redirected to Set up page enter your password and click Save. Step 4: Manage Plugins: By Default Jenkins comes in with prebuilt plugins like svn, maven,scp for installing extra plugins you can go to availables tab and install. Step 5: Accessing Repository to download source code and build •Here I will be using SVN & SSH •As I am in my home directory I will be using my ~/.ssh/id_rsa Keys for Authentication •Click on Add Credentials => Global Credential and enter your credentials •Repo url: svn+ssh://firstname.lastname@example.org/projects •SSH Authentication Username : svn Passphrase: ****** (Null if no Passphrase) Private Key : Upload your id_rsa Key Step 6: Click on Create Job: •Type Project Name •Enter SVN Repo details •Build => Invoke Top Level Maven Target •Use Maven Version as Default •Goal : clean -Dmaven.test.skip=true package -P prod •Apply and Save. Now Its Done. If you need to send the build to some other location Enter your script in command shell this would do the Work. Step 7: Click on Build Now, The Build Should Work for you. Now it should show you a success message. Jenkins + Capistrano Integration Coming Soon. This post is created by Santosh Mohanty . You can contact him for any questions at email@example.com or message him on his linkedIn profile .