http://tomcat.apache.org/tomcat-5.5-doc/manager-howto.html#Executing_Manager_Commands_With_Ant

In the <$TOMCAT_HOME>/lib folder there should be a JAR called
catalina-ant.jar.  Make sure it is in your ANT classpath.  Import the ant
tasks in your ant script:

<taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask"/>
<taskdef name="list" classname="org.apache.catalina.ant.ListTask"/>
<taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask"/>
<taskdef name="resources"
classname="org.apache.catalina.ant.ResourcesTask"/>
<taskdef name="roles" classname="org.apache.catalina.ant.RolesTask"/>
<taskdef name="start" classname="org.apache.catalina.ant.StartTask"/>
<taskdef name="stop" classname="org.apache.catalina.ant.StopTask"/>
<taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask"/>


Then call it:

<target name="deploy_dev" description="Deploy the WAR to Tomcat">
  <*deploy *
      path="/${app.name}"
      username="${tomcat.dev.username}"
      war="file:${package.name}/${war.build.dir}/${app.name}.war"
      password="${tomcat.dev.pwd}"
      url="${tomcat.dev.url}"
  />
</target>


On Mon, Aug 6, 2012 at 11:04 AM, Pedro Perez <guerr...@gmail.com> wrote:

> Thanks for your reply ... I actually am using different Tomcat deployments
> for Jenkins and my other app...my difficulty was in disabling the process
> killer from Jenkins when Jenkins is run through Tomcat (there are lots of
> instructions on how to disable the process killer when Jenkins is run as a
> java process without Tomcat).
>
> I should look into that ANT task for deploying a webapp without
> stopping/starting Tomcat...I don't know much about how to set that up
> however.
>
> Thanks!
> P
>
>
> On Monday, August 6, 2012 9:50:04 AM UTC-7, Jeff Vincent wrote:
>>
>> I'm a relative n00b to Jenkins but if I were you, I wouldn't run your
>> application on the same tomcat instance.  You are making your life harder.
>>  Why not create another instance for deploying/testing the app?  You can
>> run multiple versions and/or instances of tomcat on different ports, run
>> one in a VM or on another system.
>>
>> Regardless, tomcat can undeploy/redeploy an application without stopping.
>>  There is an ant Task for tomcat to allow deploying applications via the
>> management API that do not require stopping or starting tomcat or affecting
>> jenkins....unless it blows up or consumes memory, in which case it will
>> mess up all applications running in that instance and kill your build/test
>> processes anyway...so again, I wouldn't do it that way.
>>
>> Also if you were using Maven to build, there is a plugin that allows you
>> to start a new tomcat instance for testing then shuts it down afterward.
>>  I've not used it though.  There could be something similar for ANT.
>>
>> On Mon, Aug 6, 2012 at 10:20 AM, Pedro Perez <guerr...@gmail.com> wrote:
>>
>>> Hello,
>>>
>>> I'm new to Jenkins and so far I love it...but I have an issue
>>> integrating with Tomcat. I have Jenkins stopping and starting Tomcat via
>>> ant script. However I've found that Jenkins process-killer shuts down
>>> tomcat for me after it's finished. I've read https://wiki.jenkins-ci.**
>>> org/display/JENKINS/**ProcessTreeKiller<https://wiki.jenkins-ci.org/display/JENKINS/ProcessTreeKiller>
>>>  and
>>> have tried to disable it, however I run Jenkins through Tomcat, and I'm not
>>> sure how to disable the process killer when Jenkins is run as a simple web
>>> app on Tomcat 7. I tried to simply override the BUILD_ID variable like this:
>>>
>>> $BUILD_ID=dontKillMe
>>>
>>> to no avail. Even if that worked though, I'm wondering if there is a
>>> "cleaner" solution to starting and stopping Tomcat with Jenkins. When using
>>> ANT to start/stop it usually works, but not 100% every time. I've read
>>> about a tomcat plugin for Jenkins, but I think it doesn't stop/start Tomcat
>>> in the order I need it...basically my build script does a code checkout,
>>> compile, stop tomcat, replace war, start tomcat, run tests against newly
>>> deployed web app.
>>>
>>> Does anybody know the "correct" way to interact with Tomcat and Jenkins?
>>>
>>> Thanks
>>> Pedro
>>>
>>
>>
>>
>> --
>> Jeff Vincent
>> predato...@gmail.com
>> See my LinkedIn profile at:
>> http://www.linkedin.com/in/**rjeffreyvincent<http://www.linkedin.com/in/rjeffreyvincent>
>> I ♥ DropBox <http://db.tt/9O6LfBX> !!
>>
>>


-- 
Jeff Vincent
predato...@gmail.com
See my LinkedIn profile at:
http://www.linkedin.com/in/rjeffreyvincent
I ♥ DropBox <http://db.tt/9O6LfBX> !!

Reply via email to