Skip to main content

Setup jenkins and build maven code in less than 15 minutes

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:
sudo yum install git
to verify that git is installed properly use the following command:
git --version
Second, 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 jenkins

I 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 java
To start Jenkins run the following command on terminal:
sudo service jenkins start
sudo chkconfig jenkins on
now 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

Popular posts from this blog

Setup ELK Stack & Apache Kafka from Docker Compose YAML File

This tutorial is to setup ELK stack and Apache Kafka environment using one docker-compose YAML file. Please note that for following tutorial you should have a docker agent and docker compose installed on your host machine. All the images are present on docker hub and only two commands are used to get the environment up and running. Following are the images deployed by this script : 1) Default official ElasticSearch Image from docker hub at port 9200 and the line 9200:9200 binds the port of docker image of ElasticSearch to the machine IP at 9200 port. 2)Default official Kibana Image from docker hub at port 5601 and the line 5601:5601 binds the port of docker image of Kibana to the machine IP at 5601 port. and links it to elasticsearch by using the line elasticsearch:elasticsearch. 3) Default official Zookeeper Image from docker hub at port 2181 and the line 2181:2181 binds the port of docker image of Zookeeper to the machine IP at 2181 port. 4)Kafka Image is ches/kafka image f

Oracle SOA BPEL Interview Questions

Following are some questions often asked in SOA BPEL Interviews What are the Major Elements in WSDL? Answer:  1) types 2) message 3) portType 4) binding Explain about SOAP Structure? Answer:  1)Envelope ->indentifies the xml doc as a SOAP message 2)Header   ->contains header information 3)Body Element ->contains call and response information 4)Fault Element ->containing errors and status information What are the BPEL activities? Answer:  1)Assign Activity 2)Transform Activity 3)Invoke Activity 4)Recieve Activity 5)Scope Activity 6)Wait Activity 7)Empty Activity Difference between Complex Type and Simple Type element? Answer:  Complex Type ->because it contains other elements Simple Type     ->these elements contain other elements Difference between synchronous and Asynchronous process? Answer:  Asynchronous refers to processes that do not depend on each other's outcome, and can therefore occur on                 different