Build.xml To create Build.xml in eclipse, select File- Exports, a popup window is opened select Ant Buildfiles and click next button, then select the project and click finish. Now you can see build.xml file. Code for Clean: <delete> <exclude name="**/*.properties"/> <delete dir="work"/> • • • • •
In the target tag we will give the name. In delete tag we will specify what we want to delete (clean). In Fileset tag we give the specified path, from where we want to perform our cleaning operations. In include tag we will specify all the files which we want to delete (clean). In exclude tag we will specify all the files which we don’t want to delete (clean).
Code for .war file: <war destfile="E:/USC/workspace/USC_ERP_RECKON/usc1.war" webxml="E:/USC/workspace/USC_ERP_RECKON/WEB-INF/web.xml"> <exclude name="**/*.jar"/> <exclude name="**/*.class"/> <exclude name="**/*.properties"/> <exclude name="**/web.xml"/> •
In the target tag we will give the name for the war file. And in the depends, we have to specify on which the war file is depended on, here it is depending on compilation.
• • • •
In war tag we will specify destfile & webxml. At destfile we give the path where we want to store our war file and at webxml we will give the path of web.xml. In Fileset tag we give the specified path, from where we want to perform our operations. In exclude tag we will specify all the files which we don’t want to include in the creation of war file. In the classes tag we will give the path of the classes directory.
Code for deploying war file: • • • •
In the target tag we will give the name as deploy. In the copy tag, at todir we will give the Tomcat server’s webapp directory path, where we want to place the created war file. In fileset tag, we will give the path from where we have to copy the war file. In the includes tag, we will give the name of the war file.