This is a small tutorial to get you to setup Jenkins with git hub and build maven code in few minutes.
First, we install git on our host machine using the following commands:
Add the Jenkins repository to the yum repo, and install Jenkins from here. Run the following commands on terminal:
https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins
Jenkins requires Java in order to run.If it is not already present to install the Open Java Development Kit (OpenJDK) run the following:
Enter admin password of Jenkins (shown in the terminal when Jenkins was installed) and log on to Jenkins. If you do not remember password it is available at the following path /var/lib/jenkins/secrets/initialAdminPassword
Click on Install suggested plugins
On the main page go to Manage jenkins->Manage plugins.
And install git plugin and select install without restart
Now go to manage Jenkins and go to Global Tool Configuration
For JDK and Maven check install automatically checkbox. For JDK you will need to add your credentials for oracle account, If you do not already have an oracle account you can setup it in a few minutes and it is free to make.
Now go to Jenkins home page click on the new item, enter the name of your job and select maven freestyle project.
In Source Code Management enter the git hub URL of your maven code. If it is a private repository click add button in front of credentials and enter the credentials
In Build set Root POM: pom.xml and in Goals and options: clean install
For continuous integration go into Build Triggers and check the Poll SCM check box and write the following command: H/5 * * * *
Now click apply and then save. After that on the Hudson job you created click build now
If everything is fine your job will build and the jar will be created for your maven project.
Please ask me if you have any queries or comments about this post.
References :
Image for Jenkins from official website https://jenkins.io/
First, we install git on our host machine using the following commands:
sudo yum install gitto verify that git is installed properly use the following command:
git --versionSecond, we install Jenkins
Add the Jenkins repository to the yum repo, and install Jenkins from here. Run the following commands on terminal:
sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo sudo rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key sudo yum install jenkinsI am using a Redhat distribution.If you are using any other OS go to the following link and run the commands as described respective to your OS:
https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins
Jenkins requires Java in order to run.If it is not already present to install the Open Java Development Kit (OpenJDK) run the following:
sudo yum install javaTo start Jenkins run the following command on terminal:
sudo service jenkins start sudo chkconfig jenkins onnow go to localhost:8080 or ||hostname IP||:8080 (note port 8080 needs to be opened for this if you are trying to access hostname IP instead of localhost) to open Jenkins.
Enter admin password of Jenkins (shown in the terminal when Jenkins was installed) and log on to Jenkins. If you do not remember password it is available at the following path /var/lib/jenkins/secrets/initialAdminPassword
Click on Install suggested plugins
On the main page go to Manage jenkins->Manage plugins.
And install git plugin and select install without restart
Now go to manage Jenkins and go to Global Tool Configuration
For JDK and Maven check install automatically checkbox. For JDK you will need to add your credentials for oracle account, If you do not already have an oracle account you can setup it in a few minutes and it is free to make.
Now go to Jenkins home page click on the new item, enter the name of your job and select maven freestyle project.
In Source Code Management enter the git hub URL of your maven code. If it is a private repository click add button in front of credentials and enter the credentials
In Build set Root POM: pom.xml and in Goals and options: clean install
For continuous integration go into Build Triggers and check the Poll SCM check box and write the following command: H/5 * * * *
Now click apply and then save. After that on the Hudson job you created click build now
If everything is fine your job will build and the jar will be created for your maven project.
Please ask me if you have any queries or comments about this post.
References :
Image for Jenkins from official website https://jenkins.io/
Comments
Post a Comment