jboss 4.0.4 GA构建、部署及初始化duke's bank应用的build文件

本文介绍如何使用Ant脚本和JBoss 4.0.4 GA构建、部署Duke's Bank应用。该应用包括编译源代码、打包EJB、WAR文件和Java客户端等步骤,并创建必要的数据库表及插入数据。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 jboss 4.0.4 GA的build文件

jboss文档中,构建、部署及初始化duke's bank应用的步骤如下:

第一步、Compiling the Java Source

ant -f jboss-build.xml compile

第二步、Package the EJBs

ant -f jboss-build.xml package-ejb 

第三步、Package the WAR File

ant -f jboss-build.xml package-web

第四步、Package the Java Client

ant -f jboss-build.xml package-client 

第五步、Assembling the EAR

ant -f jboss-build.xml assemble-app

第六步、Creating the Database Schema:

to create the necessary tables

ant -f jboss-build.xml db-create-table

populate them with the required data.

ant -f jboss-build.xml db-insert 

第七步、Deploying the Application

ant -f jboss-build.xml deploy 

 

详细build文件如下:

<project name="jboss-dukes-bank" default="all" basedir=".">
    
<property file="../../jboss-build.properties"/>

    
<property name="lib.dir"   value="../../libs"/>
    
<property name="src.dir"   value="${basedir}/src"/>
    
<property name="build.dir" value="${basedir}/build"/>



    
<!-- The classpath for running the client -->
    
<path id="client.classpath">
        
<pathelement location="${build.dir}"/>
        
<fileset dir="${jboss.home}/client">
            
<include name="**/*.jar"/>
        
</fileset>
    
</path>


    
<!-- The build classpath -->
    
<path id="build.classpath">
        
<path refid="client.classpath"/>
    
<fileset dir="${jboss.server}/lib/">
            
<include name="javax.servlet*.jar"/>
        
</fileset>
    
</path>

    
<!-- Hypersonic SQL classpath -->
    
<path id="hsql.classpath">
        
<pathelement location="${jboss.server}/lib/hsqldb.jar"/>
    
</path>

    
<!-- =================================================================== -->
    
<!-- Initialises the build.                                              -->
    
<!-- =================================================================== -->
    
<target name="prepare">
        
<mkdir dir="${build.dir}"/>
    
</target>

    
<!-- ================================================================ -->
    
<!-- Compiles the source code                                         -->
    
<!-- ================================================================ -->
    
<target name="compile" depends="prepare">
        
<javac destdir="${build.dir}" classpathref="build.classpath"
               debug
="on">
            
<src path="${src.dir}"/>
        
</javac>
    
</target>

    
<target name="package-ejb" depends="compile">
        
<mkdir dir="jar" />
        
<delete file="jar/account-ejb.jar"/>

        
<jar jarfile="jar/bank-ejb.jar">
            
<metainf dir="dd/ejb" includes="**/*.xml" />

            
<fileset dir="${build.dir}">
                
<include name="com/sun/ebank/util/**"/>
                
<include name="com/sun/ebank/ejb/**" />
            
</fileset>
        
</jar>
    
</target>

    
<target name="package-ws">
        
<mkdir dir="jar" />
        
<delete file="jar/bankws-ejb.jar"/>

        
<jar jarfile="jar/bankws-ejb.jar">
            
<metainf dir="dd/ws"  includes="**/*" />

            
<fileset dir="${build.dir}">
                
<include name="com/jboss/ebank/**" />
                
<include name="com/sun/ebank/ejb/account/AccountController**"/>
                
<include name="com/sun/ebank/ejb/exception/**"/>
                
<include name="com/sun/ebank/util/**"/>
            
</fileset>
        
</jar>
    
</target>

    
<target name="package-client" depends="compile">
        
<mkdir dir="jar" />
        
<copy todir="${build.dir}">
            
<fileset dir="${src.dir}">
                
<include name="**/appclient/*.properties"/>
            
</fileset>
            
<mapper type="flatten"/>
        
</copy>
        
<delete file="jar/app-client.jar"/>

        
<jar jarfile="jar/app-client.jar">
            
<metainf dir="dd/client" includes="*.xml"/>
            
<fileset dir="${build.dir}">
                
<include name="com/sun/ebank/appclient/**"/>
                
<include name="com/sun/ebank/ejb/exception/**"/>
                
<include name="com/sun/ebank/util/**"/>
                
<include name="com/sun/ebank/ejb/customer/Account.class"/>
                
<include name="com/sun/ebank/ejb/customer/AccountHome.class"/>
            
</fileset>
            
<fileset dir="dd/client">
                
<include name="jndi.properties"/>
            
</fileset>
            
<fileset dir="${src.dir}/com/sun/ebank/">
                
<include name="appclient/*.properties"/>
            
</fileset>
        
</jar>
    
</target>

    
<target name="package-web" depends="compile">
        
<mkdir dir="jar" />
        
<delete file="jar/web-client.war"/>

        
<copy file="web/WebMessages.properties" 
              tofile
="web/WebMessages_en.properties" />

        
<war warfile="jar/web-client.war" webxml="dd/web/web.xml">
            
<fileset dir="web">
                
<include name="*.jsp"/>
                
<include name="template/*"/>
                
<include name="images/*.gif"/>
            
</fileset>
            
<webinf dir="dd/web">
                
<include name="jboss-web.xml"/>
            
</webinf>
            
<webinf dir="web">
                
<include name="*.tld"/>
                
<exclude name="*.jsp"/>
                
<exclude name="*.txt"/>
                
<exclude name="images/**"/>
            
</webinf>
            
<webinf dir="jar">
                
<include name="*.tld"/>
            
</webinf>
            
<lib dir="${lib.dir}">
                
<include name="jstl.jar"/>
                
<include name="standard.jar"/>
            
</lib>
            
<classes dir="${build.dir}">
                
<include name="**/*.class"/>
                
<exclude name="com/sun/ebank/appclient/**"/>
                
<exclude name="com/sun/ebank/ejb/**"/>
                
<exclude name="com/sun/ebank/util/**"/>
            
</classes>
            
<classes dir="web">
                
<include name="*.properties"/>
            
</classes>
        
</war>
    
</target>

    
<target name="wstool">
       
<taskdef name="wstools" classname="org.jboss.ws.tools.ant.wstools">
           
<classpath refid="build.classpath" />
       
</taskdef>

       
<wstools dest="dd/ws"
                config
="wstools-config.xml"/>
    
</target>

    
<target name="deploy-ws">
        
<copy file="jar/bankws-ejb.jar" todir="${jboss.server}/deploy"/>
    
</target>

    
<target name="run-ws">
        
<java classname="com.jboss.ebank.WSClient" fork="true">
            
<jvmarg value="-Djava.endorsed.dirs=${jboss.home}/lib/endorsed" />

            
<classpath>
                
<path refid="client.classpath"/>
                
<pathelement path="${java.class.path}"/>
            
</classpath>
        
</java>
    
</target>

    
<target name="ws" depends="wstool,package-ws,deploy-ws">
    
</target>


    
<!-- Creates an ear file containing the ejb jars and the web client war. -->
    
<target name="assemble-app">
        
<delete file="jar/JBossDukesBank.ear"/>
        
<ear destfile="jar/JBossDukesBank.ear" appxml="dd/application.xml">
            
<fileset dir="jar" includes="*-ejb.jar,app-client.jar,*.war,*.wsr"/>
            
<fileset dir="src" includes="users.properties,roles.properties"/>
        
</ear>
    
</target>

    
<!-- Deploys the EAR file by copying it to the JBoss deploy directory.  -->
    
<target name="deploy" depends="assemble-app">
        
<copy file="jar/JBossDukesBank.ear" todir="${jboss.server}/deploy"/>
    
</target>

    
<!-- Run the standalone client -->
    
<target name="run-client">
        
<echo>${java.class.path}</echo>
        
<java classname="com.sun.ebank.appclient.BankAdmin" fork="yes">
            
<classpath>
                
<pathelement path="jar/app-client.jar"/>
                
<path refid="client.classpath"/>
                
<pathelement path="${java.class.path}"/>
            
</classpath>
        
</java>
    
</target>

    
<!-- Call the HSQL ScriptTool utility. -->
    
<target name="db-create-table">
        
<java classname="org.hsqldb.util.ScriptTool" fork="yes">
            
<arg value="-url"/>
            
<arg value="jdbc:hsqldb:hsql:"/>
            
<arg value="-database"/>
            
<arg value="//localhost:1701"/>
            
<arg value="-script"/>
            
<arg value="sql/hsql-create-table.sql"/>
            
<classpath refid="hsql.classpath"/>
        
</java>
    
</target>
    
<target name="db-insert">
        
<java classname="org.hsqldb.util.ScriptTool" fork="yes">
            
<arg value="-url"/>
            
<arg value="jdbc:hsqldb:hsql:"/>
            
<arg value="-database"/>
            
<arg value="//localhost:1701"/>
            
<arg value="-script"/>
            
<arg value="sql/hsql-insert.sql"/>
            
<classpath refid="hsql.classpath"/>
        
</java>
    
</target>
    
<target name="db-list">
        
<java classname="org.hsqldb.util.ScriptTool" fork="yes">
            
<arg value="-url"/>
            
<arg value="jdbc:hsqldb:hsql:"/>
            
<arg value="-database"/>
            
<arg value="//localhost:1701"/>
            
<arg value="-script"/>
            
<arg value="sql/hsql-list.sql"/>
            
<classpath refid="hsql.classpath"/>
        
</java>
    
</target>
<!--
    <target name="db-delete">
        <java classname="org.hsqldb.util.ScriptTool" fork="yes">
            <arg value="-url"/>
            <arg value="jdbc:hsqldb:hsql:"/>
            <arg value="-database"/>
            <arg value="//localhost:1701"/>
            <arg value="-script"/>
            <arg value="sql/delete.sql"/>
            <classpath refid="hsql.classpath"/>
        </java>
    </target>
    <target name="db-reset-key">
        <java classname="org.hsqldb.util.ScriptTool" fork="yes">
            <arg value="-url"/>
            <arg value="jdbc:hsqldb:hsql:"/>
            <arg value="-database"/>
            <arg value="//localhost:1701"/>
            <arg value="-script"/>
            <arg value="sql/hsql-reset-key.sql"/>
            <classpath refid="hsql.classpath"/>
        </java>
    </target>
-->
    
<target name="clean">
       
<delete dir="${build.dir}" />
       
<mkdir dir="${build.dir}"  />
    
</target>


    
<target name="db-all" depends="db-create-table,db-insert,db-list" />

    
<target name="all" depends="compile,package-ejb,package-web,package-client,assemble-app,deploy" />


</project>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值