简体   繁体   English

在Jenkins中将战争部署到Tomcat容器中

[英]Deploying war into Tomcat container in Jenkins

I have used the Deploy to Container plugin in Jenkins and facing couple of issues here: 我已经在Jenkins中使用了Deploy to Container插件,并且在这里面临几个问题:

  1. How do we provide credentials for tomcat container in Jenkins admin console? 我们如何在Jenkins管理控制台中为tomcat容器提供凭据?
  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. 我正在尝试向Tomcat容器部署战争,但在jenkins控制台输出中找不到任何与部署相关的日志。

Can someone who has used plugin for deploying war into the Tomcat container respond the this query please. 使用插件将战争部署到Tomcat容器中的人是否可以响应此查询。

  1. Make sure you have "Deploy to Container" plugin installed ( https://plugins.jenkins.io/deploy ) 确保已安装“部署到容器”插件( 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 通过单击页面左侧菜单栏上的“ New Item链接来创建新作业
  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... 向下滚动到Post-build Actions然后在数据字段中填写以下信息...

WAR/EAR Files: **/*.war WAR / EAR文件:** / *。war

Context path: /your-path-name 上下文路径:/ your-path-name

  1. Select the version of Tomcat you want then click the Add button next to the "Credentials" field and select Jenkins 选择所需的Tomcat版本,然后单击“凭据”字段旁边的“ Add按钮,然后选择Jenkins
  2. In the popup window, make sure the Kind field is Username with password 在弹出窗口中,确保“ Kind字段是Username with password
  3. Create a username / password that Jenkins will use for Tomcat, then click Add 创建Jenkins将用于Tomcat的用户名/密码,然后单击“ Add
  4. When you are returned to the main job page, scroll to the bottom and click Apply then Save 返回到主作业页面后,滚动到底部,然后单击“ Apply然后单击“ Save
  5. Now create the user in Tomcat by navigating to the Tomcat X.0/conf/tomcat-users.xml file 现在,通过导航到Tomcat X.0/conf/tomcat-users.xml文件在Tomcat中创建用户。
  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. 向下滚动到<tomcat-users>标记,然后在其下方添加您刚刚在Jenkins中创建的用户/密码凭据<user username="your-username" password="your-password" roles="manager-gui"/>然后保存并退出。
  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 现在,您必须通过导航到ROOT jenkins文件夹将war文件放置在适当的项目文件夹中(如果忘记了根目录,请查看Manage Jenkins下的Configure System页面。
  8. In your root folder navigate to `C:...\\YourRootFolder\\workspace\\YourJobName' and paste your .WAR file 在您的根文件夹中,导航到“ C:... \\ YourRootFolder \\ workspace \\ YourJobName”,然后粘贴您的.WAR文件
  9. Restart Jenkins AND Tomcat! 重新启动Jenkins和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). 使用在STEP 4中指定的上下文路径导航到已部署的.WAR文件http://localhost:8080/your-path-name (确保端口是您设置为在其上运行Tomcat服务器的端口。默认值为8080)。

DONE! 完成!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM