On 3/19/2014 7:43 PM, marcos wrote:
On Wed, Mar 19, 2014 at 8:48 PM, Mark Eggers <[email protected]> wrote:

On 3/19/2014 1:45 PM, marcos wrote:

Tomcat 7.0.52
Ant 1.9.2
Windows 7


I am trying to use an Ant task to deploy a specific version of a tomcat
app. I want to do this bacause of the parallel deployment feature.

My task so far:

<target name="tomcat.deploy" >
    <deploy url="http://host/manager/text"; username="${deploy.user}"
password="${deploy.pass}" path="/"
war="file:${build-directory}/ROOT%23%23${version}.war"/>
   </target>

But it is not working, what can I do to be able to deploy a specifi
version?

Marcos


After reading the documentation here:

http://tomcat.apache.org/tomcat-7.0-doc/deployer-howto.html
http://wiki.apache.org/tomcat/AntDeploy

I came up with the following ant script:

<?xml version="1.0"?>
<project name="platform" basedir="." default="deployit">
   <!-- external tasks and properties -->
   <property environment="env"/>
   <property file="build.properties"/>
   <taskdef classname="org.apache.catalina.ant.DeployTask"
     name="deploy"

classpath="${env.ANT_HOME}/lib/catalina-ant.jar:${env.
ANT_HOME}/lib/tomcat-coyote.jar"/>
   <target name="deployit">
     <deploy url="${deploy.url}"
             username="${deploy.user}"
             path="${deploy.context}"
             password="${deploy.password}"
             war="file:${deploy.war}"
             version="${deploy.version}"/>
   </target>
</project>

And the build.properties file:

#
# deploying to tomcat
# user / password must have roles="manager-script"
#
deploy.user=foo
deploy.password=rah
deploy.url=http://localhost:8080/manager/text
deploy.context=/RWeb
deploy.war=/home/mdeggers/src/ant-src/tc-manage/RWeb.war
deploy.version=001

Please note that the classpath attribute may be wrapped in the email. It
should be one line. If you're doing lots of these (see below), you may want
to use a classpathref attribute instead of a classpath attribute in your
taskdef.

http://tomcat.apache.org/tomcat-7.0-doc/manager-howto.html

This works as advertised on Fedora 20 with JRE/JDK 1.7.0_51, Ant 1.8.2
(haven't upgraded yet), and Tomcat 7.0.52.

. . . . just my two cents
/mde/

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


Thanks for the help, with the version attribute I got this message: "Deploy
doesn't support the "version" attribute.

What can be wrong?


What's the taskdef's classpath? Where did you get the JARs used in the taskdef's classpath?

I would probably recommend downloading the deployer from:

http://tomcat.apache.org/download-70.cgi

Then:

1. Unzip the file (you're on Windows, so I guess you'll use the zip
   file)
2. Create an ant path element with an id that includes all those JARs
   in the lib directory from the deployer
3. Use a classpathref in the taskdef statement (rather than a classpath)

I just did a quick and dirty (copied the JARs from my Tomcat installation) test above.

Your mileage may vary.

. . . . just my two cents.
/mde/

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to