Friday, December 2, 2011

Ant build XML file

Ant build XML file ---------------------
<?xml version="1.0" encoding="UTF-8"?>
<project name="ApplicationService Build File" default="install">
<description>Builds Activation</description>

<!-- Project directories -->
<property name="root" value="E://Dev/CLP_4_0_0/4.0.0/AAServer/Samples/JAVA/ApplicationService"/>
<property file="${root}/build.properties"/>
<property name="temp.lib" value="${root}/lib"/>
<property name="axis.lib" value="${war.axis.lib}"/>
<property name="src" value="${root}/src"/>
<property name="classes" value="${root}/classes"/>
<property name="axis2.classes" value="${war.axis2.classes}"/>
<property name="war.proj.home" value="${war.file.home}/webapps" />
<property name="war.proj.loc1" value="${war.file.loc1}" />
<property name="war.proj.loc2" value="${war.file.loc2}" />
<property name="war.proj.loc3" value="${war.file.loc3}" />
<property name="war.proj.loc4" value="${war.file.loc4}" />
<property name="war.proj.TestServer" value="${war.file.TestServer}" />

<!-- project-specific variables -->
<!--Time stam added for war file creation
<tstamp />
<property name="webapp.name" value="ApplicationService-${DSTAMP}-${TSTAMP}" />-->
<property name="webapp.name" value="ApplicationService" />
<property name="package.name" value="${webapp.name}.war" />
<property name="dest.dir" value="target" />
<property name="package.file" value="${dest.dir}/${package.name}" />

<!-- put everything in a temp folder with the right structure during the build -->
<property name="temp.dir" value="temp" />
<property name="temp.dir.web-inf" value="${temp.dir}/WEB-INF" />
<property name="temp.dir.lib" value="${temp.dir.web-inf}/lib" />
<property name="temp.dir.classes" value="${temp.dir.web-inf}/classes" />
<property name="temp.dir.modules" value="${temp.dir.web-inf}/modules" />
<property name="temp.dir.meta-inf" value="${temp.dir}/META-INF" />
<property name="temp.dir.classes.axis2" value="${temp.dir.web-inf}/classes/org/apache/axis2/webapp" />
<property name="webroot" value="${root}/WebContent" />
<property name="jsp.dir" value="${webroot}" />

<!-- Classpath -->
<path id="classpath.build">
<fileset dir="${temp.lib}">
<include name="**/*.jar"/>
</fileset>
<fileset dir="${axis.lib}">
<include name="**/*.jar"/>
</fileset>

</path>


<target name="create_web_service_stubs"
description="Compiles all test files.">

<java classname="org.apache.axis.wsdl.WSDL2Java"
fork="true"
dir="${src}">
<classpath refid="classpath.build" />
<arg line=" -f ../NStoPkg.properties -w ../schema-public/UserOrgHierarchyService.wsdl"/>
</java>
</target>

<target name="clean">
<delete>
<fileset dir="${dest.dir}" includes="**/*"/>
</delete>
<delete dir="${temp.dir}" />
<delete dir="${temp.dir.classes}" />
<delete dir="${temp.dir.modules}" />
<delete dir="${temp.dir.meta-inf}" />
<delete dir="${temp.dir.web-inf}" />
<delete dir="${temp.dir.classes.axis2}" />

</target>

<target name="prepare" depends="clean">
<mkdir dir="${dest.dir}" />
<mkdir dir="${temp.dir}" />
<mkdir dir="${temp.dir.lib}" />
<mkdir dir="${temp.dir.meta-inf}" />
<mkdir dir="${temp.dir.web-inf}" />
<mkdir dir="${temp.dir.classes}" />
<mkdir dir="${temp.dir.modules}" />
<mkdir dir="${temp.dir.classes.axis2}" />
</target>

<!-- COMPILE -->
<target name="compile" depends="prepare">
<echo>=== COMPILING SOURCE ===</echo>
<echo>Compiling ${src} files ...</echo>
<javac debug="on" srcdir="${src}" destdir="${temp.dir.classes}" includes="**/*">
<classpath refid="classpath.build" />
</javac>
</target>

<!-- PACKAGE -->
<target name="package" depends="compile">
<echo>=== CREATING ARCHIVE ===</echo>

<!-- copy the config files -->
<copy file="${webroot}/META-INF/MANIFEST.MF" tofile="${temp.dir.meta-inf}/MANIFEST.MF" overwrite="true" />
<copy file="ErrorDictionary.properties" tofile="${temp.dir.classes}/ErrorDictionary.properties" overwrite="true" />

<copy todir="${temp.dir.web-inf}" overwrite="true">
<fileset dir="${webroot}/WEB-INF">
<include name="**/*.xml"/>
<include name="**/*.tld"/>
<include name="**/*.list"/>
<include name="**/*.aar"/>
<include name="**/*.class"/>
<include name="**/*.wsdl"/>
</fileset>
</copy>

<copy todir="${temp.dir.classes}" overwrite="true">
<fileset dir="${src}">
<include name="**/*.properties"/>
<include name="**/*.xml"/>
<include name="**/*.dtd"/>
</fileset>
</copy>

<copy todir="${temp.dir.classes.axis2}" overwrite="true">
<fileset dir="${axis2.classes}">
<include name="**/*.class"/>
</fileset>
</copy>

<copy todir="${temp.dir.modules}" overwrite="true">
<fileset dir="${webroot}/WEB-INF/modules">
<include name="**/*.mar"/>
</fileset>
</copy>

<echo>=== CREATING war ===</echo>
<!-- with all resources in place, create the war file -->
<war destfile="${package.file}" webxml="${temp.dir.web-inf}/web.xml" basedir="${temp.dir}">
<fileset dir="${jsp.dir}">
<include name="**/*.jsp"/>
<include name="**/*.inc"/>
<include name="**/*.css"/>
<include name="**/*.html"/>
<include name="**/*.gif"/>
<include name="**/*.jpg"/>
<include name="**/*.jar"/>
<include name="**/*.txt"/>
</fileset>
<lib dir="${temp.lib}" />
<classes dir="${temp.dir.classes}" />
</war>
<echo>=== complete ARCHIVE ===</echo>
</target>



<!-- INSTALL -->
<target name="install" depends="package">
<!--
<echo>=== STOPPING SERVER ===</echo>
<java jar="${tomcat.home}/bin/bootstrap.jar" fork="true">
<jvmarg value="-Dcatalina.home=${tomcat.home}"/>
<arg line="stop"/>
</java>
<sleep seconds="2"/>

<echo>=== DELETING APP ===</echo>
<delete dir="${war.proj.home}/${webapp.name}" />-->

<echo>=== COPYING ARCHIVE ===</echo>
<tstamp>
<format property="Time_Stamp" pattern="ddMMyyyyHHmmss"/>
</tstamp>
<copy file="${package.file}" tofile="${war.proj.loc2}/${Time_Stamp}/${package.name}" overwrite="true" />
<!--<copy file="${package.file}" tofile="${war.proj.loc2}/${Time_Stamp}/${package.name}" overwrite="true" />
<copy file="${package.file}" tofile="${war.proj.loc3}/${Time_Stamp}/${package.name}" overwrite="true" />
<copy file="${package.file}" tofile="${war.proj.loc4}/${Time_Stamp}/${package.name}" overwrite="true" />
<copy file="${package.file}" tofile="${war.proj.TestServer}/${Time_Stamp}/${package.name}" overwrite="true" />-->
</target>
<!--<echo>=== DELETING APP FROM TOMCAT===</echo>
<delete dir="${tomcat.home}/wtpwebapps/${webapp.name}" />
<echo>=== COPYING ARCHIVE IN TOMCAT===</echo>
<copy file="${package.file}" tofile="${tomcat.home}/wtpwebapps/${package.name}" overwrite="true" />
<echo>=== START TOMCAT SERVER ===</echo>
<java jar="${tomcat.home}/bin/bootstrap.jar" fork="true">
<jvmarg value="-Dcatalina.home=${tomcat.home}"/>
</java>

<tstamp>
<format property="Time_Stamp" pattern="yyyyMMddHHmmss"/>
</tstamp>
<copy file="${package.file}" tofile="${test.retomte.path}/${Time_Stamp}/${package.name}" overwrite="true" />-->

<delete dir="${temp.dir}" />
</project>


build.properties---------------------
#tomcat.home=C\:/Program Files/Apache Software Foundation/Tomcat 6.0

tomcat.home=C\:/apache-tomcat-6.0.29
war.file.home=E\:/Dev/CLP_4_0_0/4.0.0/AAServer/Samples/JAVA/ApplicationService/conf_build
war.axis.lib=E\:/axis2-1.5.1/lib
war.axis2.classes=E:/axis2-1.5.1/webapp/WEB-INF/classes/org/apache/axis2/webapp
war.file.loc1=//10.25.22.116/e$/WarFileLoc/ApplicationService
war.file.loc2=//10.25.22.117/e$/WarFileLoc/ApplicationService
war.file.loc3=//10.25.22.118/e$/WarFileLoc/ApplicationService
war.file.loc4=//10.25.22.119/e$/WarFileLoc/ApplicationService
war.file.TestServer=//10.25.57.140/e$/TestDeployer/ApplicationService
test.retomte.path=//10.25.17.153/SLAA_Build
#tomcat.home=C\:/apache-tomcat-6.0.29/webapps

No comments:

Post a Comment