Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[higgins-dev] Deployment of STS

Hi All,

FYI, it could be usefull for some people and I've not seen these tasks on 
current build.xml 's.
I've added locally some Ant task to deploy automatically war files on tomcat, 
allowing to save time used for opening the tomcat manager, undeploying and 
deploying applications.
The project ant-contrib is necessary, the definition of ${tomcat.dir} and 
${ant-contrib.dir}, and of course the "good" admin password and tomcat host.
Here is an example of tasks added to the axis.service build.xml:

#################################################
<taskdef resource="net/sf/antcontrib/antlib.xml">
  <classpath>
    <pathelement location="${ant-contrib}/lib/ant-contrib.jar"/>
  </classpath>
</taskdef>

<taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask">
        <classpath>
            <pathelement path="${tomcat.dir}/server/lib/catalina-ant.jar"/>
        </classpath>
</taskdef>

<taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask">
        <classpath>
            <pathelement    path="${tomcat.dir}/server/lib/catalina-ant.jar"/>
        </classpath>
</taskdef>

<target name="Deploy" depends="war">
            <property name="path" value="/BindingAxis1xService" />
            <property name="host" value="localhost" />
            <property name="admin.passwd" value="secret" />
            <property name="tomcat.host" value="http://${host}:8080/manager"/>

            <echo message="Deploying on ${tomcat.host}" />

            <trycatch>
                    <try>
                            <undeploy url="${tomcat.host}" 
                            		username="admin" 
                            		password="${admin.passwd}" 
                            		path="${path}" />
                    </try>
                    <catch />
                    <finally>
                            <deploy url="${tomcat.host}" 
                            		username="admin" 
                            		password="${admin.passwd}" 
                            		path="${path}" 
                            		war="${warfile}" />
                    </finally>
            </trycatch>

</target>
#################################################

Maybe it can be added with modifications into related CVS build.xml's ?
And After the jim suggestion to add a warAll talk; a deployAll task ?
 
Anthony.


Back to the top