Jenkins auto deploy tomcat 7

whirlwin picture whirlwin · Feb 14, 2012 · Viewed 54.7k times · Source

We're trying to deploy a war file with Jenkins, but nothing seems to happen.

The project is built successfully, and we're using Jenkins deploy plugin. It is configured with the following options:

auto deploy plugin

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.

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

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?

Answer

Bill Clark picture Bill Clark · Apr 1, 2012

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

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="tomcat" password="pencil" roles="manager-script"/>

(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.