Introduction to Jenkins

Reading Time: 5 minutes

What is Jenkins


How Jenkins work?

Below point explains the work flow of jenkins:

1) Developers commit and push their code

2) Jenkins will pick up the changed source code and trigger a build and run the test cases.

3) The build output will be available in the jenkins dashboard. Automatic notification can be sent back to the developer.

Getting Started with Jenkins:

1) System Requirements

  • Jenkins requires Java7 or above to function. Java8 is recommended.
  • Jenkins requires a fair amount of memory to operate well.

Setup JAVA_HOME in .bashrc :

export JAVA_HOME=path_to_java

2) Download Jenkins

Starting Jenkins:

Open the command prompt. From the command prompt, browse to the directory where the jenkins.war file is present. Run the following command:

java -jar jenkins.war

After the command is run, various tasks will run, one of which is the extraction of the war file which is done by an embedded webserver called winstone. Once the processing is complete without major errors, the following line will come in the output of the command prompt.

INFO: Jenkins is fully up and running

Note: Jenkins by default use port 8080. To run it on different port :

java -jar jenkins.war –httpPort=9090

It will run jenkins. at port 9090

Accessing Jenkins

Once Jenkins is up and running, one can access Jenkins from the link −http://localhost:8080 (default)

This link will bring up the Jenkins dashboard.


Setting up Jenkins with Tomcat

The following prerequisites must be met for Jenkins Tomcat setup.

Step 1: Verify Java Installation

To verify Java installation, open the console and execute the following java command.

It should display output as per the version like :

java version “1.8.0_92”



Step2: Verify whether JAVA_HOME variable is set

It can be done using command, where output must specify the path of Java Home:


If the path is not set, then set JAVA_HOME environment variable to point to the base directory location where Java is installed on your machine. Eg.

export JAVA_HOME=path_to_java

Step 3: Download Tomcat

1) From official website of tomcat:, download tar.gz file From “Binary Distributions” under Core bullet.

2) Then extract the contents of the downloaded tar.gz file.

Step 4: Jenkins and Tomcat Setup

Copy the Jenkis.war file which was downloaded from the previous section and copy it to the webapps folder in the tomcat folder.

Now open the command prompt. From the command prompt, browse to the directory where the tomcat folder is located. Browse to the bin directory in this folder and run the below command



INFO: Server startup in 1310 ms

Open the browser and go to the link −http://localhost:8080/jenkins. Jenkins will be up and running on tomcat.


NOTE : If the port is already in use, it can be changed in file server.xml inside conf folder of apache-tomcat.

Following lines define the port number in server.xml:



redirectPort=”8443″ />

Here 8080 can be replaced with any other unused port (say 9090)

Now to open the browser and go to the link −http://localhost:9090/jenkins. Jenkins will be up and running on tomcat.

Jenkins-Git Setup

Following are the steps to be followed:

1) In your Jenkins Dashboard (Home screen), click the Manage Jenkins option on the left hand side.

2) In the next screen, click the ‘Manage Plugins’ option.


4) The list will then be filtered. Check the Git Plugin option and click on the button ‘Install without restart’.

5) The installation will then begin and the screen will be refreshed to show the status of the download.

6) Once all installations are complete, restart Jenkins by issuing the following command in the browser.




NOTE: In case Git is already setup then it will be available in Installed tabs in “Manage Plugins”

Jenkins-Maven Setup

Maven Download

1) From official homepage of maven :// download the link to the file under “Files Section”

2) Once the file is downloaded, extract the files at your local directory say /opt/local-maven/apache-maven-3.3.9

Jenkins-Maven setup

1) In the Jenkins dashboard (Home screen), click Manage Jenkins from the left-hand side menu.

2) Click on ‘Configure System’ from the right hand side.

3) In the Configure system screen, scroll down till you see the Maven section and then click on the ‘Add Maven’ button.

4) Uncheck the ‘Install automatically’ option.

5) Add any name for the setting and the location of the MAVEN_HOME. For example:

Name: localmaven

MAVEN_HOME: /opt/local-maven/apache-maven-3.3.9

6) Then, click on the ‘Save’ button at the end of the screen.

Note: If you are using 2.x version of jenkins, you can find maven at

Jenkins(Home) -> Manage Jenkins -> Global Tool Configuration

You can now create a job with the ‘Maven project’ option. In the Jenkins dashboard, click the New Item option.

If you still cannot see “Maven Project” in “New” window then perform the given steps:

1) Click Manage Jenkins

2) Click Manage Plugins

3) Search for “Maven Integration plugin” using filter and click on “Install without Restart”

4) Once the download is complete, restart jenkins by hitting URL :

http://IP_ADDRESS: TOMCAT_PORT/jenkins/restart


Now you are ready to build and test your maven projects.




Written by 


Knoldus Pune Careers - Hiring Freshers


%d bloggers like this: