`
hongsoft
  • 浏览: 291834 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

用jbpm_bpel学jwsdp的ant方式使用

阅读更多

用过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

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics