Sunday, 7 September 2025

Integrate Tomcat with Jenkins and Deploy Java app on a Tomcat server


  1. Install 'deploy to container' plugin. This plugin needs to deploy on tomcat server.
  • Install 'deploy to container' plugin without restart
    • Manage Jenkins > Jenkins Plugins > available > deploy to container





  1. Jenkins should need access to the tomcat server to deploy build artifacts. setup credentials to enable this process. use credentials option on Jenkins home page.
  • setup credentials
    • credentials > jenkins > Global credentials > add credentials
      • Username : deployer
      • Password : deployer
      • id : deployer
      • Description: user to deploy on tomcat server




Enter an item name: JavaApp

  • Source Code Management:

    • Repository: https://github.com/rajkumargupta14/hello-world-1
    • Branches to build : */master
  • Poll SCM : - * * * *

  • Build:

    • Root POM:pom.xml
    • Goals and options: clean install package
  • Post-build Actions

    • Deploy war/ear to container
      • WAR/EAR files : **/*.war
      • Containers : Tomcat 8.x
        • Credentials: deployer (user created on above)
        • Tomcat URL : http://<PUBLIC_IP>:8080
















Save and run the job now. Once done access by using Public IP and port number 8080



No comments:

Post a Comment