Tomcat Ant Tasks

xiaoxiao2021-03-05  32

TomcatantTasks Search Wiki: Your Trail:

-------------------------------------------------- ------------------------------

I finally figured out how to use Tomcat's Ant Tasks (install, remove, reload, start, stop, list) in AppFuse to ease deployment of the app. Below is a list of of the steps I used to integrate them into my build.xml File.

1. Rather Than Defining Each Task with a , i created a tomcattasks.properties File with the Following Contents:

deploy = org.apache.catalina.ant.DeployTaskinstall = org.apache.catalina.ant.InstallTasklist = org.apache.catalina.ant.ListTaskreload = org.apache.catalina.ant.ReloadTaskremove = org.apache.catalina.ant. RemoveTaskresources = org.apache.catalina.ant.ResourcesTaskroles = org.apache.catalina.ant.RolesTaskstart = org.apache.catalina.ant.StartTaskstop = org.apache.catalina.ant.StopTaskundeploy = org.apache.catalina.ant. Undeploytask

2. Then I created a tomcat.properties file with the following contents. Make sure the $ CATALINA_HOME / conf / tomcat-users.xml file has an entry with username / password admin / admin and that they have the manager role.

# Properties for tomcat serverTomcat.server = localhosttomcat.manager.url = http: // $ {Tomcat.server}: 8080 / managertomcat.userName = adminTomcat.password = admin

3. I include a reference to tomcat.properties in my build.xml file:

4. Then I added all a single Taskdef and all the targets / tasks i wanded to use to my build.xml file:

NOTE: There Are A Few Things I Discovered in this process:

If you put a context.xml file in your WAR's META-INF directory, the deploy task will recognize it and use it. This is the same as defining your context in server.xml or putting an appname.xml file in $ CATALINA_HOME / webapps In Tomcat 4, this Only Works with the Deploy Task. In Tomcat 5, this Will Work with any War - Even if you just drop it Into $ CATALINA_HOME / WebAPPS.

That's a very slick feature imo. Now if Thee Was Only A Way To Deploy The JDBC Driver with the War And Have IT Auto-Deployed to $ Catalina_Home / Common / Lib.

All these tasks will overwrite your server.xml file in Tomcat 4.1.x. They do create a backup, but if you're having configuration issues after using these, revert back to your original server.xml. I've included a minimal server .xml for tomcat 4.1.29. Also, The War Is Deployed Under The $ CATALINA_HOME / WORK / Standalone / Localhost / Manager Directory. in Tomcat 4.1.x, The Reload Target Doesn't Work with Wars. You have to use "Ant Stop Start "to Simulate a reload.

The good news is that all of the issues that occur in Tomcat 4.1.x are gone in Tomcat 5.In Tomcat 5, the server.xml is not overwritten. The context.xml is extracted where you would expect it ($ CATALINA_HOME / conf / Catalina / localhost, and the war is deployed (and expanded) to the WebApps Directory. The Reload Target Works in Tomcat 5 - Providing you don't have any non-serializeable attributes in your session.

Attachments: Server-minimal-4.1.29.xml 2693 BYTES Server-minimal-5.0.16.xml 1680 Bytes

转载请注明原文地址:https://www.9cbs.com/read-32200.html

New Post(0)