WebLogic/ WebServices/ Ant/ Sample

┌────┐
build.xml
└────┘

<'?xml version="1.0" encoding="UTF-8"?>
<'project name="hoge" default="default" basedir="..">

<'!-- ====================== -->
<'!-- PROPERTY DEFINITIONS -->
<'!-- ====================== -->
<'!-- set global properties for this build -->
<'property environment="env"/>
<'!-- [WebLogic Environment Settings] -->
<'property name="BEA_HOME" value="C:\bea" />
<'property name="WL_HOME" value="${BEA_HOME}\wlserver_10.0" />
<'property name="PORT" value="7001" />

<'property name="deploy.dir" value="${basedir}\build\deploy" />
<'property name="webservice.dir" value="${basedir}\build\jws" />
<'property name="wsdl.dir" value="${basedir}\build\wsdl" />

<'property name="webinfo.dir" value="${basedir}\WebContent\WEB-INF" />
<'property name="source.dir" value="${basedir}\sources" />
<'property name="classes.dir" value="${basedir}\classes" />
<'property name="lib.dir" value="${basedir}\lib" />
<'property name="client_ear_file" value="hoge-client" />
<'property name="client_war_file" value="hoge-client" />

<'taskdef name="clientgen" classname="weblogic.wsee.tools.anttasks.ClientGenTask" />

<'!-- ====================== -->
<'!-- TARGET DEFINITIONS -->
<'!-- ====================== -->
<'!-- the default target -->
<'target name="default" depends="clean, native2ascii, webservice-materials" />

<'target name="clean" description="cleaning all directories." >
 <'delete includeemptydirs="true" failonerror="false" >
  <'fileset dir="${classes.dir}" includes="**/*" />
 <'/delete>
 <'delete failonerror="false" >
  <'fileset dir="${deploy.dir}" includes="**/*.ear" />
 <'/delete>
 <'delete failonerror="false"
  <'fileset dir="${webservice.dir}" includes="**/*.*" />
 <'/delete>
 <'delete failonerror="false">
  <'fileset dir="${wsdl.dir}" includes="**/*.wsdl" />
 <'/delete>
<'/target>

<'!-- check the presense of webservices.jar file -->
<'target name="checkjar">
 <'available file="${WL_HOME}/server/lib/webservices.jar" property="webservices.jar.present" />
<'/target>
<'target name="check" depends="checkjar" unless="webservices.jar.present">
 <'fail>
  webservices.jar file was not found. download it from BEA web site and place it in WL_HOME/server/lib directory.
 <'/fail>
<'/target>

<'!-- convert the code of property files to ascii-code. -->
<'target name="native2ascii">
 <'delete>
  <'fileset dir="${classes.dir}" includes="**/*.properties" />
  <'fileset dir="${classes.dir}" includes="**/*.properties.sjis" />
 <'/delete>
 <'!-- copy the property files to classes directory -->
 <'native2ascii encoding="Shift_JIS" src="sources" dest="${classes.dir}" includes="**/*.properties" />
 <'!-- convert properties to japanese which in resource directory -->
 <'!--
 <'native2ascii encoding="Shift_JIS" src="sources" dest="${classes.dir}" includes="**/*.properties.sjis" ext="" />
 -->
<'/target>

<'target name="re-native2ascii">
 <'delete>
  <'fileset dir="${classes.dir}" includes="**/*.properties" />
  <'fileset dir="${classes.dir}" includes="**/*.properties" />
 <'/delete>
<'/target>

<'target name="build-webservice-ear" description="generating a ear file contains all files required for webservice.">
 <'servicegen
  desEar="${webservice.dir}/${client_ear_file}.ear"
  warName="${client_war_file.war}">
  <'classpath>
   <'pathelement path="${WL_HOME}\server\lib\webserviceclient.jar" />
   <'pathelement path="${WL_HOME}\server\lib\weblogic.jar" />
   <'pathelement path="${WL_HOME}\server\lib\wseeclient.jar" />
   <'pathelement path="${lib.dir}\hoge.jar" />
   <'pathelement path="${classes.dir}" />
   <'pathelement path="C:\Sun\SDK\jdk\lib" />
  <'/classpath>
  <'service
   javaClassComponents="com.grandpapkg.parentpkg.childpkg.HogeReceiver"
   targetNamespace="http://childpkg.parentpkg.grandpapkg.com"
   serviceName="HogeHogeSerive"
   serviceURI="/HogeReceiver"
   generateTypes=True"
   expandMethod="True">
   <'client
    packageName="childpkg.parentpkg.grandpapkg.com"
    clientJarName="hoge-receiver-client.jar" />
  <'/service>
  <'service
   javaClassComponents="com.grandmapkg.parentpkg.childpkg.AnotherHogeReceiver"
   targetNamespace="http://childpkg.parentpkg.grandmapkg.com"
   serviceName="AnotherHogeHogeService"
   serviceURI="/AnotherHogeReceiver"
   generateTypes="True"
   expandMethods="True">
   <'client
    packageName="childpkg.parentpkg.grandmapkg.com"
    clientJarName="another-hoge-receiver-client.jar" />
  <'/service>
 <'/servicegen>
<'/target>

<'target name="webservice-materials"
 depends="build-webservice-ear" description="preparing all materials needed for webserivce.">
 <'!-- get webService materials out from ear file. -->
 <'copyfile dest="${webservice.dir}/tmp/${client_ear_file}.zip" src="${webservice.dir}/${client_ear_file}.ear" />
 <'unzip dest="${webservice.dir}/tmp/${client_ear_file}" src="${webservice.dir}/tmp/${client_ear_file}.zip" />
 <'unwar dest="${webservice.dir}/tmp/${client_ear_file}/${client_war_file}" src="${webservice.dir}/tmp/${client_ear_file}/${client_war_file}.war" />
 <'copy todir="${webservice.dir}">
  <'!-- the jar-file which has stub, mapping classes for webServiceClient. -->
  <'fileset dir="${webservice.dir}/tmp/${client_ear_file}/${client_war_file}">
   <'include name="*.jar" />
  <'/fileset>
  <'!-- web-service.xml which defines IF for webServiceServer. -->
  <'fileset dir="${webservice.dir}/tmp/${client_ear_file}/${client_war_file}/WEB-INF">
   <'include name="web-services.xml" />
  <'/fileset>
 <'/copy>
 <'copy todir="${webinf.dir}" description="copy the same web-service.xml to WEB-INF." overwrite="true">
  <'fileset dir="${webservice.dir}/tmp/${client_ear_file}/${client_war_file}/WEB-INF">
   <'include name="web-services.xml" />
  <'/fileset>
 <'/copy>
 <'!-- comment in following pert if you need wsdl-files. -->
 <'!-- get the wsdl-files out from created ear-file. -->
 <'unjar dest="${webservice.dir}/tmp" overwrite="yes">
  <'fileset dir="${webservice.dir}">
   <'include name="*.jar" />
  <'/fileset>
 <'/unjar>
 <'copy todir="${wsdl.dir}" includeemptydirs="no" flatten="yes">
  <'fileset dir="${webservice.dir}/tmp">
   <'include name="**/*.wsdl" />
  <'/fileset>
 <'/copy>
 <'delete dir="${webservice.dir}/tmp" />
<'/target>


<'/project>

tag : Ant build.xml

2009-05-18 06:38 : apsrv : コメント : 0 : トラックバック : 0 :
コメントの投稿
非公開コメント

« next  ホーム  prev »

search

ad



counter


tag cloud

category cloud