This document provides steps to integrate Git, Java, and Maven with Jenkins. It involves installing the necessary software, configuring Git with a username and email, creating a test directory and adding files to a GitHub repository. Global tools are configured in Jenkins, including JVM, Git, and Maven paths. A new Jenkins job is then created from the GitHub repository URL. The job is configured to build and test the Maven project.
Download as TXT, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
31 views
Integration of Git Java and Maven To Jenkins
This document provides steps to integrate Git, Java, and Maven with Jenkins. It involves installing the necessary software, configuring Git with a username and email, creating a test directory and adding files to a GitHub repository. Global tools are configured in Jenkins, including JVM, Git, and Maven paths. A new Jenkins job is then created from the GitHub repository URL. The job is configured to build and test the Maven project.
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2
INTERGRATION OF GIT, JAVA AND MAVEN TO JENKINS
Step1: we need to install java 8
sudo apt-get install openjdk-8-jdk Step2: sudo apt update Step3: to check java version java -version Step4: we need to install git sudo apt-get install git Step5: to check git version git --version Step6: we need to configure in git git config --global user.name "username" git config --global user.email "emailID" Step7: we need to create a directory for saving project and add to git mkdir test cd test(to change the directory) Step8: we need to add files to github git add . Step9: to check whether all files are added or not git status Step10: we need to commit the project git commit -m "first repo" Step11: we need to add the code of the project from github git remote add origin "passte the url of the repository" Step12: git push origin main 12.1 we need to enter username 12.2 we need to enter password 12.2.1 go to my settings 12.2.2 go to developer settings 12.2.3 generate personal access token and copy the token to use it as the password Step13: we need to install maven sudo apt install maven Step14: to check the maven version mvn -version Step15: Install Java to Execute Jenkins war file. sudo add-apt-repository ppa:webupd8team/java sudo apt-get update sudo apt install openjdk-8-jdk Step16: Now Install Jenkins on Machine Add Key on Host wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add - Step17: Add following entry in your /etc/apt/sources.list echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list Step18: Update your local package index, then finally install Jenkins sudo apt-get update sudo apt-get install jenkins Step19: open web browser and type localhost:8080 Step20: now we get a path to get administration password for jenkins copy the path and paste in terminal sudo cat (path) Step21: now create an account in jenkins Step22: now open manage configurations 22.1 manage plugins 22.1.1 under avaiable plugins search for GITHUB INTEGRATION and install without restart 22.2 global tool configuration 22.2.1 now add jvm path 22.2.1.1 name 22.2.1.2 path (/usr/lib/java/java-8-jdk/bin)(path can be checked from terminal by first typing 1./usr/lib/java tab 2./usr/lib/java/java-8/ tab and add bin and change directory to java path to paste in jenkins) 22.2.2 now add git 22.2.2.1 name 22.2.2.1 path (either give git) or (the code of repository) or (the url where the pom.xml file is saved) at last we need to give /pom.xml 22.2.3 now add maven 22.2.3.1 name 22.2.3.2 path (/usr/share/maven) when the path is shown red then it is not correct Step23: now create a new item 23.1 name of the file 23.2 click add readme and save 23.3 we need to give description 23.4 select git in source code management 23.5 copy the url from code in github and path near git repository 23.6 the branch from where we are integrating git to jenkins should be a default branch in github 23.6.1 change the main to master default branch 23.6.1.1 go to settings 23.6.1.2 change the project branch as default 23.7 come down to build and select invoke top-level maven targets 23.7.1 set goals to TEST INSTALL 23.8 now click build now 23.8.1 check console output if it shows success build is done perfectly and it is shown in GREEN color 23.8.2 if it shows console failure check the errors and solve and it is shown in RED color