问题描述
我们正在尝试使用Jenkins部署war文件,但似乎没有任何事情发生。
We're trying to deploy a war file with Jenkins, but nothing seems to happen.
项目已成功构建,我们正在使用Jenkins部署插件。它配置了以下选项:
The project is built successfully, and we're using Jenkins deploy plugin. It is configured with the following options:
后期步骤设置为无论构建结果如何都运行。
Post steps are set to "run regardless of build result".
我已检查过凭证是正确的,因为我可以在浏览器中访问经理页面。
I have checked that the credentials are correct, as I can acces the manager page in my browser.
这是Jenkins(Maven)输出的最后一部分:
Here is the last part that Jenkins (Maven) outputs:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1:24.506s
[INFO] Finished at: Tue Feb 14 12:10:45 UTC 2012
[INFO] Final Memory: 22M/52M
[INFO] ------------------------------------------------------------------------
channel stopped
Finished: SUCCESS
我也可以将WAR / EAR文件更改为不存在的内容,它不会给我错误有点奇怪。我在这里做错了什么?
I can also change WAR/EAR file to something that doesn't exist, and it will not give me errors, which is kind of strange. What am I doing wrong here?
推荐答案
我遇到了同样的问题,在我的情况下是(相对)路径WAR文件不正确。显然,如果你没有完全正确(它需要相对于工作区根目录),那么部署插件将无声地失败。在我的情况下,路径是:
I was having the same problem, and in my case the (relative) path to the WAR file was incorrect. Apparently if you don't have it exactly correct (it needs to be relative to the workspace root) then the deploy plugin will silently fail. In my case the path was:
target / whatever.war
target/whatever.war
一旦修复,我遇到了一个不同的问题是插件期望连接到Tomcat Manager的管理器/文本版本,而不是我通常默认配置的manager / html版本。您需要在tomcat-users.xml文件中添加一行,如下所示:
Once that was fixed, I ran into a different problem in that the plugin expects to connect to the manager/text version of Tomcat Manager, rather than the manager/html version that I usually configure by default. You'll need a line in your tomcat-users.xml file like the following:
< user username =tomcatpassword =pencilroles =manager -script/>
<user username="tomcat" password="pencil" roles="manager-script"/>
(这是你可能已经设置的manager-gui角色的补充。)
(This is in addition to the "manager-gui" role you probably already have set up.)
完成这些更改后,构建和部署工作正常。
Once those changes were made, the build and deployment worked just fine.
这篇关于Jenkins自动部署tomcat 7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!