How to Install and Configure Jenkins on Windows
Step-by-step guide to configure Jenkins
Introduction:
Jenkins is an open source CI/CD automation software. We will learn how to set it up, specifically for a Maven project, to run automation tests built with Java programming language.
Step-1 : Download and Run the Jenkins.WAR file
Download the file from : jenkins.war . Go to the jenkins.war file location on your system and open the command prompt. Run the below command :
java -jar jenkins.war
Once the server is up and running, it will provide an initial admin password, as shown in the above screenshot. Save the password. Or you can find it in /.jenkins/secret file.
Step-2 : Set up Admin user (first time users)
It should show the message "Jenkins is fully up and running". By default, Jenkins runs on the 8080 port. On successful server start, open the Jenkins UI be entering the below URL on your favourite browser :
Jenkins will as ask for the Admin password, the one we saved earlier.
Step-3 : Jenkins deafult installations
Now, Jenkins will install few plugins by deafult, to be able to run on our machine. It will take some time.
To run our project CI job/pipeline, we will further need to install some other plugins as well.
Click on Install suggested plugins.
Step-4 : Admin user set up
Now, we will have to create an admin user by filling up below fields and click Save and Continue.
Click Save for Jenkins URL and then done! Jenkins is ready to use.
Step-5 : Manage Jenkins global configurations
Our automation framework is built on Maven and written in Java. So we need to configure it globally in Jenkins. Go to Manage Jenkins -> Tools
We need to add JDK and set Maven automatic installation and Save the configurations : It is preferable to have jdk > = 17 as Jenkins will no longer support with jdk 11.
Step-6 : Download plugins
In our project we are using several dependencies like TestNG for our testing framework, Maven for build tool, ExtentReport and AllureReport for report generation etc. We need to install these plugins on Jenkins as well, to be able to view test results.
Go to Manage Jenkins -> Plugins -> Available plugins
Now search for Maven Integration, HTML Publisher, TestNG Results and Allure, check them one by one. Click on Install. The plugins should start downloading.
Once the downloads are done, we can create a new Jenkins job, configure GIT repo and test results reports etc and run the job!