Saturday, February 16, 2019

Create Freestyle job in Jenkins | How to create build job in Jenkins to automate Java build and deployment of WAR into Tomcat

Jenkins is popular open source Continuous integration tool. It was written entirely in Java. Jenkins is a self-contained automation server used for automating builds, tests and deployment.

See below the steps for configuring Jenkins to automate the build and deployment for the Java project we already set up in GitHub.

  • Jenkins is up and running
  • Tomcat is up and running
  • Make sure you configure maven installation under Jenkins-->manage Jenkins-> Global Tool Configuration. under maven installation. enter Maven3 as name, enter path of maven installation --> /usr/share/maven and uncheck install automatically option.

  • Also install deploy to container Jacoco plugins under Jenkins --> Manage Jenkins --> Manage plug-ins

Click on Available, type Deploy to container, select it. enter Jacoco, select it. Click on Install without restart.

Deploy to container


Click on without restart.

steps to automate MyWebApp project in Jenkins:

1. Login to Jenkins. Click on New item.

2. Enter an item name --> select Free style project.
enter name as myFirstAutomateJob. click OK.
3. under source code mgmt, click git. enter Bitbucket URL or GitHub URL
Click on your repo, Copy the url from the browser. Paste the url as Repository URL below.

under credentials --> click Add- > select Jenkins -->  enter your GitHub username and Personal Access Token as password. DO NOT use Git Hub password as it is removed from August 13, 2021. Click to here to learn how to generate Personal Access Token. Add description as my SCM credentials.

Enter main as branch specifier or which ever branch you want to check out.

4. select that from drop down.
5. under build trigger click on poll scm, enter this value to check

for every 2 mins --> H/02 * * * *

6. Build --> Add build step --> invoke top level maven targets -->

select Maven3 from drop down and goal as clean install

7. Click on advanced, enter the path of POM file as --> MyWebApp/pom.xml

8. click on Add post build action, select Record Jacoco Code coverage report
9. click on Add post build action, select deploy war/ear to container.

      for WAR/EAR files enter as 

in WAR/EAR files, leave context path empty

   10. click on Add container , select Tomcat 9.x

   11. click on add credentials, enter tomcat as user name and password as password.
      select it from drop down.

13. tomcat url should be --> http://your_public_dns_name:8080

click Apply, click Save
click on build now..It should build.
if there is any error, please check the console output. Most of the common error would be checking the path of Maven installation, valid credentials for GitHub or Tomcat. Also make sure you install the plug-ins.

After successful deployment, please make sure you check the output in Tomcat by going to browser and enter below URL

You should see Hello World!!!

This is how you automate the builds and deployments using Jenkins. Please watch the steps in YouTube channel:


  1. This comment has been removed by a blog administrator.

    1. Big data is a term that describes the large volume of data – both structured and unstructured – that inundates a business on a day-to-day basis. big data projects for students But it’s not the amount of data that’s important.Project Center in Chennai

      Spring Framework has already made serious inroads as an integrated technology stack for building user-facing applications. Corporate TRaining Spring Framework the authors explore the idea of using Java in Big Data platforms.

      Spring Training in Chennai

      The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training

  2. Apart from that, you might have to interact with customers, vendors and outside business partners hence, for such instances you need to develop some skills in order to increase your productivity.go check out

  3. This comment has been removed by a blog administrator.

  4. Thank you very much for this useful article. I like it. World talent jobs

  5. clean installation and deployment

  6. Coach, Tomcat port number from previous lab was 8090, but you left it as 8080 here. I understand 8080 is the default for Tomcat.

  7. But you are not alone, many people just like you, during their working lifetime change careers not once but many times. profile

  8. not building in Jenkins....having deploy war/ear to container error. How do i fix this

  9. Videos likewise create 1200% a bigger number of offers than both text and pictures consolidated.

  10. There is so much in this article that I would never have thought of on my own. Your content gives readers things to think about in an interesting way. Thank you for your clear information. IT Recruitment

  11. By allowing you to see the quantity of perspectives on every video you can see what items or administrations potential clients are really intrigued youtube watch hours

  12. I really enjoy the blog. Really looking forward to read more. Keep writing.
    know more


How to check whether my user data passing to EC2 instance is working | AWS EC2 bootstrap script log

The cloud-init output log file ( /var/log/cloud-init-output.log ) captures console output so it is easy to debug your scripts following a la...