Jenkins auto deploy tomcat 7 Jenkins auto deploy tomcat 7 jenkins jenkins

Jenkins auto deploy tomcat 7


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.


I use the Hudson Post Build Task plugin to execute a curl against the /manager/text API

The plugins mentioned can be selected and installed from the list of available plugins in the Jenkins configuration.

Once you have the plugin installed you just need to enable the "Post build task" and add the next line:

curl -T - -u user:pass 'http://<tomcat-host>/manager/text/deploy?update=true&path=/<yourpath>' < <path_to_war_file>

For example:

curl -T - -u manager:123456 'http://localhost:8080/manager/text/deploy?update=true&path=/slim' < /target/dist/slim.war

You can also use wget, but with the command above you log the output and see if there was a problem with the deploy.


Here's documentation related to the /manager/text service


Hm have you used Cargo plugin? Well, I also had the same configuration as you, Jenkins, maven and tomcat. But when I needed to deploy, I was simply using that plugin. It's been a while actually, but in Jenkins you were able to enter command prompt lines right? Like mvn clean install? So, what you can do is simply configure your pom for Cargo plugin and then add that line to your Jenkins:

mvn cargo:deploy -Pintegration

By this way, I was able to clean install my builds daily, and deploy them to Tomcat. Afterwards I was doing my rest tests.