Auto Deployment of Eclipse WAR fiel to Tomcat using ANT Scripts

Category:

Auto Deployment of Eclipse WAR fiel to Tomcat using ANT Scripts
Eclipse allows us to run the application and then export the application to a standard WAR file. But then someone has to manually do the following steps :
Export the project to a WAR file using Eclipse Interface
Copy the WAR file from the location created to the Tomcat webapps folder
Here is a better alternative and a solution to the question :
Create an ANT script that will look at the Eclipse Project structure and build the WAR file and copy over the WAR file to the destination (Tomcat WebApps folder)
Here is the ANT script:




















Save the above code into a file and name it “build.xml”. Place the build.xml into the root folder of your eclipse project. For example, if “c:\projects” is my eclipse workspace and “SanFrancisco” is the name of my project then all the files related to the project will be under “c:\projects\SanFrancisco”.
You can run the ant command inside the projects root folder either using any ANT tool installed or if you have ArcGIS Java ADF installed then there is a customized ANT tool executable available for use.
Here is the usage:
1. Create the WAR file and deploy it to tomcat
"c:\program files\arcgis\java\tools\ant\build\arcgisant" deploy
2. Just create the WAR file
"c:\program files\arcgis\java\tools\ant\build\arcgisant" create
3. Just copy over the WAR file to deploy location
"c:\program files\arcgis\java\tools\ant\build\arcgisant" copy
4. Unpack the WAR file to see the contents
"c:\program files\arcgis\java\tools\ant\build\arcgisant" unpack

Comments (0)

Post a Comment