Jenkins manages all the tasks into something called as jobs. Each job represents some set of activity like build process or software deploy or executing some scripts.
We will create a sample job to understand it better.
Click Create new jobs or New Item => Enter name – “first-jenkins-job” => Select Freestyle project => OK
Go to Build section => From drop down select shell => Enter some Linux commands “free -m” ; w => Save.
After saving the project, we land up into the job’s dashboard. Click Build Now to execute this project.
After the execution is completed we can check the history of the executed jobs and check its output from it.
Click on the blue ball to see the output of the job.
We have seen from above example that setting up a Jenkins job is not such a challenging task. But you need to know what information goes up in the Jenkins job. In the next task, we will create an actual build job.
Setup a Java build job with Maven
We are going to use a publicly available java source code from github to test the build job. https://github.com/wakaleo/game-of-life.git
This java source code can be built by Maven. It also has the pom.xml file which maven needs to build the code.
Go to Jenkins main dashboard => Click New Item => Give a name to your job => Freestyle => OK
Source Code Managment
Copy the URL of gameoflife source code from github.
Go to source code management section in Jenkins and select on Git
Enter the game of life github url.
This is a public repository so no credentials required and we are selecting master branch
Go to build section => From drop down select Invoke top-level Maven targets => In the goals give “install” => Save
Click on Build Now => In Build history click on the loading symbol or the blinking ball to see the run time console output.
As per the Pompom of this project, this particular maven job will do below mentioned tasks.
1. Download maven dependencies to build the job.
2. Build the java source code
3. Generate artefact
4. Archive artefact
5. Run unit test cases in the source code.
Artefact of Game of life web application
After the build process is completed, you can find the artefact for this job in the Workspace of this job.
Workspace
Workspace is the place where all the data of the job gets stored, e:g source code, artefacts etc. Every job in jenkins has its own work space.
Click on workspace => gameoflife-web => target => gameoflife.war gameoflife.war is the artefact that got generated and archived by maven build process. This artefact can be deployed to the java web application server like tomcat or jboss server
Contact Us
Visualpath IT Training institute
Flat 205, 2nd floor,Nilgiri block, Aditya Enclave
Ameerpet, Hyderabad - 16
Ph: 9704455959
Email: courseinfo@visualpath.in
www.visualpath.in
Comments
Post a Comment