用jbpm_bpel學jwsdp的ant方式使用

來源:互聯網
上載者:User

用過jwsdp的同學都知道,它專門有個jwsdp-2_0-ant-docs文擋 ,可見ant與jwsdp結合的重要性。

在用jbpm-bpel的時候,當然也是最好用ant方式的jwsdp的,下面就是某個example的具體過程:

 

我們看jbpm-bpel-1.1.Beta3的examples/account/build.xml
<?xml version="1.0"?>
<project name="account" default="redeploy"> 
  <import file="../common/ws-build.xml"/>
</project>

轉到common下的ws-build.xml的redeploy:
<target name="redeploy"
          depends="generate-artifacts, deploy"
          description="regenerate artifacts and deploy application" />
1.generate-artifacts  
2.deploy

1的內容如下:
<target name="generate-artifacts"
          depends="detect-wsgenerator"
          description="generate java mapping artifacts">
    <mkdir dir="${output.java.dir}" />
    <antcall target="setup-wstools" />
    <antcall target="setup-wscompile" />
</target>
1.1 detect-wsgenerator
1.2 setup-wstools
1.3 setup-wscompile

 

1.1的內容如下:
 <target name="detect-wsgenerator">
    <available property="wstools.available"
               classname="org.jboss.ws.tools.ant.wstools"
               classpathref="jboss.path" />
    <condition property="wsgenerator.available">
      <or>
        <isset property="wstools.available" />
        <isset property="jwsdp.home" />
      </or>
    </condition>
    <fail message="no artifacts generator available"
          unless="wsgenerator.available" />
  </target>
這段首先是找  org.jboss.ws.tools.ant.wstools這個資源是否存在;如果存在,則wstools.available
賦值為true。
然後判斷 wstools.available已經有值或者jwsdp.home已經有值,如果是,則 wsgenerator.available為true。
最後,判斷 如果wsgenerator.available為false,就要拋出fail message :"no artifacts generator available"。

1.2的內容如下:
<target name="setup-wstools" if="wstools.available" unless="jwsdp.home">
    <taskdef name="wstools"
             classname="org.jboss.ws.tools.ant.wstools"
             classpathref="wstools.path" />
    <antcall target="call-wstools" />
  </target>
首先就是定義名稱為wstools的任務,對應的類是 org.jboss.ws.tools.ant.wstools;
然後調用call-wstools任務。

call-wstools任務如下:
<target name="call-wstools">
    <wstools dest="${output.java.dir}" config="${resources.dir}/wstools.xml" />
    <move file="${output.java.dir}/jaxrpc-mapping.xml"
          todir="${output.web.dir}" />
  </target>

1.2.1 wstools,傳了兩個參數進去
1.2.2 move操作。

1.3 setup-wscompile的內容如下:
<target name="setup-wscompile" if="jwsdp.home">
    <taskdef name="wscompile"
             classname="com.sun.xml.rpc.tools.ant.Wscompile"
             classpathref="wscompile.path" />
    <mkdir dir="${output.classes.dir}" />
    <mkdir dir="${output.web.dir}" />
    <antcall target="call-wscompile" />
    <delete>
      <fileset dir="${output.java.dir}" includes="**/*_Impl.java" />
      <fileset dir="${output.classes.dir}" includes="**/*_Impl.class" />
    </delete>
  </target>
首先就是定義wscompile任務,對應的類是 com.sun.xml.rpc.tools.ant.Wscompile;
mkdir然後調用wscompile任務。

1.3.1 wscompile任務如下:
<target name="call-wscompile">
    <wscompile fork="on"
               verbose="on"
               import="on"
               keep="on"
               features="norpcstructures,wsi,strict"
               base="${output.classes.dir}"
               sourcebase="${output.java.dir}"
               mapping="${output.web.dir}/jaxrpc-mapping.xml"
               config="${resources.dir}/wscompile.xml"
               classpathref="wscompile.path"
               jvmargs="-Duser.dir=${project.dir}" />
  </target>
1.3.2 是delete兩個目錄下的東西

2的內容如下:
 <target name="deploy"
          depends="pack-web"
          description="deploy application to server">
    <copy todir="${jboss.server.deploy.dir}"
          file="${output.dir}/${module.name}.war" />
  </target>

2.1 pack-web的內容如下:
<target name="pack-web" depends="compile">
    <war warfile="${output.dir}/${module.name}.war" webxml="${web.dir}/web.xml">
      <classes dir="${output.classes.dir}" />
      <webinf dir="${web.dir}" excludes="web.xml" />
      <webinf dir="${output.web.dir}" />
    </war>
  </target>
2.2是copy目錄。

就是上面這些過程了,執行結果如下;
Buildfile: D:/jbpm-bpel-1.1.Beta3/examples/account/build.xml
detect-wsgenerator:
generate-artifacts:
setup-wstools:
setup-wscompile:
    [mkdir] Created dir: D:/jbpm-bpel-1.1.Beta3/examples/account/target/classes
    [mkdir] Created dir: D:/jbpm-bpel-1.1.Beta3/examples/account/target/resources/web
call-wscompile:
[wscompile] command line: wscompile D:/eos6/jdk1.5.0_09/jre/bin/java.exe -Duser.dir=D:/jbpm-bpel-1.1.Beta3/examples/account -classpath D:/jwsdp/jaxrpc/lib/jaxrpc-api.jar;D:/jwsdp/jaxrpc/lib/jaxrpc-impl.jar;D:/jwsdp/jaxrpc/lib/jaxrpc-spi.jar;D:/eos6/jdk1.5.0_09/lib/tools.jar;D:/jbpm-bpel-1.1.Beta3/examples/account/src/main/resources com.sun.xml.rpc.tools.wscompile.Main -d D:/jbpm-bpel-1.1.Beta3/examples/account/target/classes -features:norpcstructures,wsi,strict -import -keep -mapping D:/jbpm-bpel-1.1.Beta3/examples/account/target/resources/web/jaxrpc-mapping.xml -s D:/jbpm-bpel-1.1.Beta3/examples/account/target/java -verbose D:/jbpm-bpel-1.1.Beta3/examples/account/src/main/resources/wscompile.xml
[wscompile] [ServiceInterfaceGenerator: creating service interface: org.jbpm.bpel.tutorial.account.AccountService]
[wscompile] [CustomClassGenerator: generating JavaClass for: AccountOperation]
   [delete] Deleting 1 files from D:/jbpm-bpel-1.1.Beta3/examples/account/target/java
   [delete] Deleting 1 files from D:/jbpm-bpel-1.1.Beta3/examples/account/target/classes
compile:
    [javac] Compiling 2 source files to D:/jbpm-bpel-1.1.Beta3/examples/account/target/classes
     [copy] Copying 1 file to D:/jbpm-bpel-1.1.Beta3/examples/account/target/classes
pack-web:
      [war] Building war: D:/jbpm-bpel-1.1.Beta3/examples/account/target/account.war
deploy:
     [copy] Copying 1 file to D:/eos6/app_server/jboss-4.0.5/server/default/deploy
redeploy:
BUILD SUCCESSFUL
Total time: 9 seconds

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.