Iqbal
Iqbal

Reputation: 73

Deploying war into Tomcat container in Jenkins

I have used the Deploy to Container plugin in Jenkins and facing couple of issues here:

  1. How do we provide credentials for tomcat container in Jenkins admin console?
  2. I am trying to deploy a war to Tomcat container but I am not finding any deployment related logs in the jenkins console output.

Can someone who has used plugin for deploying war into the Tomcat container respond the this query please.

Upvotes: 1

Views: 2829

Answers (1)

Dan L.
Dan L.

Reputation: 36

  1. Make sure you have "Deploy to Container" plugin installed (https://plugins.jenkins.io/deploy)
  2. Create a new job by clicking the New Item link on the menu bar on the left hand side of the page
  3. Give your job a name and select the type (ie - freestyle project)
  4. Scroll down to Post-build Actions and fill in the following info into the data fields...

WAR/EAR Files: **/*.war

Context path: /your-path-name

  1. Select the version of Tomcat you want then click the Add button next to the "Credentials" field and select Jenkins
  2. In the popup window, make sure the Kind field is Username with password
  3. Create a username / password that Jenkins will use for Tomcat, then click Add
  4. When you are returned to the main job page, scroll to the bottom and click Apply then Save
  5. Now create the user in Tomcat by navigating to the Tomcat X.0/conf/tomcat-users.xml file
  6. Scroll down to the <tomcat-users> tag and underneath it add your user/pass credentials you just created in Jenkins <user username="your-username" password="your-password" roles="manager-gui"/> then save and exit.
  7. Now you have to place your war file in the proper project folder by navigating to your ROOT jenkins folder (if you forgot where your root is check the Configure System page under Manage Jenkins
  8. In your root folder navigate to `C:...\YourRootFolder\workspace\YourJobName' and paste your .WAR file
  9. Restart Jenkins AND Tomcat!
  10. Navigate to your deployed .WAR file http://localhost:8080/your-path-name using the context path you specified in STEP 4 (make sure the port is whatever you set your Tomcat server to run on. Default is 8080).

DONE!

Upvotes: 1

Related Questions