<?xml version="1.0" encoding="gbk"?>
<project name="sj9-dims-oms" default="build" basedir=".">
<!-- 一些编译时用到的变量,主要是路径及最终jar文件名,都是相对于当前路径的相对路径 -->
<property name="ModuleName" value="sj9-dims-oms" />
<!-- 工程名 -->
<property name="SrcDir" value="src" />
<!-- 源代码路径 -->
<property name="DistDir" value="dist" />
<!-- jar文件最终分发位置 -->
<property name="WarName" value="${ModuleName}.war" />
<!-- jar包的文件名 -->
<property name="LibDir" value="WebContent/WEB-INF/lib" />
<!-- 编译时用到的第三方包 -->
<property name="BuildDir" value="build" />
<!-- build路径 -->
<property name="DestDir" value="${BuildDir}/WEB-INF/classes" />
<!-- .class路径 -->
<property name="WebServiceClass" value="com.marstor.dims.oms.service.DIMSForOMS_SJ9" />
<!-- 要创建的WebService类名 -->
<property name="WebServiceName" value="DIMSForOMS_SJ9" />
<property name="ServiceURL"
value="http://localhost:8088/sj9-dims-oms/services/${WebServiceName}" />
<!-- web service url -->
<property name="NameSpace" value="http://service.oms.dims.marstor.com" />
<!-- 命名空间 -->
<property name="Tomcat_Home"
value="D:/Program Files/Apache Software Foundation/Eclipse_Tomcat 6.0" />
<!--Tomcat路径-->
<!-- 创建路径 -->
<target name="init">
<mkdir dir="${DestDir}" />
<mkdir dir="${BuildDir}/wsdl" />
<!-- 创建临时路径 -->
<mkdir dir="${BuildDir}/temp" />
</target>
<!-- 清理 -->
<target name="clean">
<delete dir="${BuildDir}" />
<delete dir="${DistDir}" />
</target>
<!-- 设置classpath -->
<path id="classpath.id">
<fileset dir="${LibDir}">
<include name="*.jar" />
</fileset>
<fileset dir="${Tomcat_Home}/lib">
<include name="*.jar" />
</fileset>
<pathelement location="${DestDir}" />
</path>
<!-- 拷贝资源文件 -->
<target name="copyfile" depends="init">
<copy todir="${BuildDir}">
<fileset dir="WebContent">
<include name="WEB-INF/lib/*" />
<include name="WEB-INF/web.xml" />
<include name="WEB-INF/config.xml" />
</fileset>
</copy>
<copy todir="${BuildDir}/WEB-INF/classes">
<fileset dir="${SrcDir}">
<include name="**/*.xml" />
<include name="*.*" />
</fileset>
</copy>
</target>
<!-- 开始编译 -->
<target name="compile" depends="clean,init">
<javac srcdir="${SrcDir}" destdir="${DestDir}" encoding="UTF-8">
<classpath>
<path refid="classpath.id" />
</classpath>
</javac>
</target>
<taskdef name="axis-java2wsdl"
classname="org.apache.axis.tools.ant.wsdl.Java2WsdlAntTask"
loaderref="axis">
<classpath refid="classpath.id" />
</taskdef>
<taskdef name="axis-wsdl2java"
classname="org.apache.axis.tools.ant.wsdl.Wsdl2javaAntTask"
loaderref="axis">
<classpath refid="classpath.id" />
</taskdef>
<taskdef name="axis-admin"
classname="org.apache.axis.tools.ant.axis.AdminClientTask"
loaderref="axis">
<classpath refid="classpath.id" />
</taskdef>
<!-- java2wsdl -->
<target name="java2wsdl">
<axis-java2wsdl classname="${WebServiceClass}"
implclass="${WebServiceClass}"
classpath="${DestDir}"
output="${BuildDir}/wsdl/${WebServiceName}.wsdl"
location="${ServiceURL}"
namespace="${NameSpace}"
porttypename="${WebServiceName}"
serviceelementname="${WebServiceName}Service"
serviceportname="${WebServiceName}"
style="rpc"
use="literal">
</axis-java2wsdl>
</target>
<!-- wsdl2java -->
<target name="wsdl2java">
<axis-wsdl2java all="true"
debug="false"
helperGen="false"
noimports="true"
output="${BuildDir}/temp"
serverside="true"
skeletonDeploy="false"
typeMappingVersion="1.2"
url="${BuildDir}/wsdl/${WebServiceName}.wsdl"
implementationClassName="${WebServiceClass}"
verbose="false"
noWrapped="false">
<mapping namespace="${NameSpace}" package="" />
</axis-wsdl2java>
</target>
<!-- 创建server-config.wsdd -->
<target name="createWsdd">
<java classname="org.apache.axis.utils.Admin"
fork="true"
failοnerrοr="true"
dir="${BuildDir}/WEB-INF/">
<arg value="server" />
<arg file="${BuildDir}/temp/deploy.wsdd" />
<classpath>
<path refid="classpath.id" />
<pathelement location="build" />
</classpath>
</java>
<!-- 删除临时路径 -->
<delete dir="${BuildDir}/temp" />
</target>
<!-- 将编译结果打包,同时将第三方包打入自己的包 -->
<target name="build" depends="compile,copyfile,java2wsdl,wsdl2java,createWsdd">
<jar jarfile="${DistDir}/${WarName}" basedir="${BuildDir}">
<manifest>
</manifest>
</jar>
</target>
</project>