<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    常言笑的家

    Spring, Hibernate, Struts, Ajax, RoR

    appfuse配置文件解讀

     ● AppFuse的ant構(gòu)建使用非常復(fù)雜,功能也非常強(qiáng)大,怎樣能夠充分的利用它,為我所用,在今后的開發(fā)中大幅度的減輕開發(fā)量,顧做此詳細(xì)研究(其中不包括測試任務(wù))。 build.xml的正常運(yùn)行依賴以下文件i) propertie..

        AppFuse的ant構(gòu)建使用非常復(fù)雜,功能也非常強(qiáng)大,

    怎樣能夠充分的利用它,為我所用,在今后的開發(fā)中大幅度的減輕開發(fā)量,顧做此詳細(xì)研究(其中不包括測試任務(wù))。

     

     

    Ø build.xml的正常運(yùn)行依賴以下文件

    i)                 properties.xml

    該文件定義build.xml所需的屬性值,主要完成通過build.properties 產(chǎn)生

    database.properties 文件、定義構(gòu)建工具需要的Classpath屬性等工作。

     

     

    ii)                app-settings.xml

    該文件定義設(shè)置應(yīng)用程序狀態(tài)的一些屬性值

     

     

    iii)              build.properties

    定義一些全局設(shè)置屬性

     

     

    Ø build.xml文件具體分析

    <!DOCTYPE project [

        <!ENTITY properties SYSTEM "properties.xml">

        <!ENTITY app-settings SYSTEM "app-settings.xml">

    ]>

    <!XML DTD定義propertiesapp-settings -->

    <project name="dudu" basedir="." default="package-web">

        <!導(dǎo)入配置文件properties.xml(其中主要處理classpath,jar文件位置定義)-->

        <!-- import project-wide properties (classpath, jar file locations) -->

        &properties;

        <!導(dǎo)入配置文件app-settings.xml-->

        &app-settings;

        <!定義一些自定義任務(wù),-->

        <target name="init" description="defines custom tasks">

           

        </target>

        <!建立所需的目錄:build/dudu;build/dudu/WEB-INF;dist/webapps-->

        <target name="prepare" depends="build.properties.missing,init"

           

        </target>

        <!用定義的名字新建一個(gè)項(xiàng)目 -->

        <!使用方法ant new -Dapp.name=NAME -Ddb.name=NAME -->

        <!該任務(wù)會(huì)在上層目錄中構(gòu)建自定義名字應(yīng)用程序,內(nèi)容與本目錄中的大致相同-->

        <target name="new" depends="clean">

           

        </target>

     

     

    <!拷貝資源和配置文件:將web/WEB-INF/classes下的ApplicationResources_zh_CN.properties;log4j.properties等配置文件拷貝到build/web/classes下.

        拷貝src/dao/packageName/applicationContext-hibernate.xml 到dudu/WEB-INF目錄下,

        拷貝src/service/packageName/applicationContext-service.xml到dudu/WEB-INF目錄下.

    在此任務(wù)中會(huì)進(jìn)行native2ascii 的轉(zhuǎn)碼工作.

    此任務(wù)比較有用,以后可以復(fù)用.

    -->

        <target name="copy-resources" depends="prepare">

            <native2ascii src="http://dev.csdn.net/article/"web/WEB-INF/classes""

                dest="${build.dir}/web/classes"

                includes="ApplicationResources_zh_CN.properties" encoding="gb2312"/>

        </target>

       

        <!拷貝web目錄下footer.jsp; pages/*.jsp;**/classes/**;**/*-resources.xml到

            build/dudu/的對應(yīng)目錄下,拷貝時(shí)會(huì)自動(dòng)建立相應(yīng)的目錄結(jié)構(gòu)

    -->

        <target name="copy-web-files" depends="prepare">

          

        </target>

       

        <!拷貝所有頁面與配置文件以形成web應(yīng)用程序-->

        <target name="stage-web"

            depends="copy-resources,copy-web-files"

            description="Calls other targets to gather static resources"/>

           

      

        <!利用XDoclet根據(jù)POJO生成對應(yīng)的hiberante映射文件

            根據(jù)src/dao中的POJO生成映射文件,存放于build/dao/gen目錄中.

    此任務(wù)比較有用,以后可以復(fù)用.

    執(zhí)行此任務(wù)之前,需執(zhí)行ant clean刪除build目錄

    -->

        <target name="hibernatedoclet" depends="prepare"

            unless="hibernatedoclet.unnecessary"

            description="Generate Hibernate mapping files">

            <taskdef name="hibernatedoclet"

                classname="xdoclet.modules.hibernate.HibernateDocletTask"

                classpat/>

            <!-- generate hibernate files -->

            <hibernatedoclet

                destdir="${build.dir}/dao/gen"

                mergedir="metadata/dao"

                excludedtags="@version,@author"

                addedtags="@xdoclet-generated at ${TODAY}"

                force="${xdoclet.force}">

                <fileset dir="src/dao"/>

                <hibernate validatexml="true" version="2.0"/>

            </hibernatedoclet>

        </target>

     

     

    <!編譯dao模塊-->

        <target name="compile-dao" depends="hibernatedoclet">

           

        </target>

     

     

        <!將編譯好的dao模塊打包成對應(yīng)的jar文件,生成的jar文件存放在dist目錄下-->

        <target name="package-dao" depends="prepare,compile-dao"

          

        </target>

     

     

        <!編譯service模塊-->

        <target name="compile-service" depends="package-dao"

            description="Compile service module">

            <antcall target="compile-module" inheritAll="true">

                <param name="module" value="service"/>

                <reference refid="service.compile.classpath"

                    torefid="http://dev.csdn.net/article/"compile.classpath"/>

                <reference refid="service.test.classpath"

                    torefid="test.classpath"/>

            </antcall>

        </target>

     

     

        <!打包service模塊,日后開發(fā)自定義的模塊可以參考此任務(wù)編譯和打包-->

        <target name="package-service" depends="compile-service">

            <jar destfile="${dist.dir}/${webapp.name}-service.jar">

                <manifest>

                    <attribute name="Class-Path"

                        value="${webapp.name}-dao.jar ${webapp.name}-service.jar"/>

                </manifest>

                <fileset dir="${build.dir}/service/classes" includes="**/*.class"/>

            </jar>

        </target>

     

     

        <!根據(jù)POJO生成Struts 的ActionForms,生成的FormBean存放在build/web/gen下

            此任務(wù)比較有用,以后可以復(fù)用

     -->

        <target name="gen-forms" depends="prepare" unless="webdoclet.uptodate">

           

        </target>

     

     

        <!利用webdoclet生成web.xml;struts-config.xml等web應(yīng)用程序配置文件

            生成的文件放在build/dudu/WEB-INF下

            此任務(wù)比較有用,以后可以復(fù)用

    -->

        <target name="webdoclet" depends="compile-web"

            unless="webdoclet.unnecessary">

            

        </target>

      

        <!打包web模塊,處理build/dudu/WEB-INF/web.xml文件;

    根據(jù)metadata/conf/tomcat-context.xml 產(chǎn)生dist/webapps/context.xml;

    改變build/dudu/WEB-INF/ applicationContext-hibernate.xml中的路徑,以便

            dudu-dao.jar可以找到.hbm文件,

    拷貝src/web/**/*.properties和*.xml文件到build/web/classes中,

    將build/dudu下的文件打包成dist/dudu.war,其中包括build/web/classes中的文件

    生成WEB-INF/classes中的文件,

    dist/*.jar生成WEB-INF/lib中的文件

    此任務(wù)比較有用,以后可以復(fù)用

    -->

        <target name="package-web" depends="compile-web,jsp-2">

           

        </target>

      

        <!所有編譯任務(wù)都要調(diào)用的基本編譯,接收其他任務(wù)的參數(shù),編譯相應(yīng)的模塊

            輸入?yún)?shù):待編譯模塊名稱,編譯所需的路徑.

            編譯后的文件存放于build/moduleName/classes中.

            此任務(wù)比較有用,以后可以復(fù)用

    -->

        <target name="compile-module">

            <!-- Inputs: module, compile.classpath, test.classpath -->

            <echo level="info">Compiling ${module}...</echo>

            <mkdir dir="${build.dir}/${module}/classes"/>

            <mkdir dir="${test.dir}/${module}/classes"/>

            <property name="excludes" value=""/>

            <property name="additional.src.dirs" value=""/>

            <javac srcdir="src/${module};${additional.src.dirs}"

                destdir="${build.dir}/${module}/classes"

                debug="${compile.debug}"

                deprecation="${compile.deprecation}"

                optimize="${compile.optimize}"

                classpat/>

        </target>

        <!

    將數(shù)據(jù)庫中的數(shù)據(jù)導(dǎo)出為xml文件

        此任務(wù)比較有用,以后可以復(fù)用

    -->

        <target name="db-export" depends="prepare"

           

        </target>

       

        <!利用dbunit工具,根據(jù)metadata/sql/sample-data.xml 填充數(shù)據(jù)庫表記錄-->

       <target name="db-load" depends="prepare"

         

        </target>

        <!

    根據(jù)metadata/sql/${database.type}-create.sql中的sql語句建立數(shù)據(jù)庫和用戶

    此任務(wù)比較有用,以后可以復(fù)用

    -->

        <target name="db-create" depends="init">

           

        </target>

       

        <!

    根據(jù)映射hibernate映射文件生成數(shù)據(jù)庫表

    此任務(wù)比較有用,以后可以復(fù)用

    -->

        <target name="db-prepare" depends="clean,package-dao"

            description="creates database tables">

            <taskdef name="schemaexport"

                classname="net.sf.hibernate.tool.hbm2ddl.SchemaExportTask">

                <classpath>

                    <path refid="xdoclet.classpath"/>

                    <path refid="hibernate.classpath"/>

                </classpath>

            </taskdef>

            <antcall target="generate.database.properties"/>

            <schemaexport quiet="no" text="no" drop="no" delimiter=";"

                properties="database.properties" output="create-tables.sql">

                <fileset dir="${build.dir}/dao/gen" includes="**/*.hbm.xml"/>

            </schemaexport>

        </target>

     

     

        <!刪除數(shù)據(jù)庫中的表-->

    <target name="db-drop" depends="hibernatedoclet">

       

        </target>

           

        <!刪除目錄-->

        <target name="clean" description="Removes build artifacts">

            <delete dir="${build.dir}"/>

        </target>

     

     

        <!生成JavaDoc,生成文件存放在E:\dudu\build\docs\api -->

        <target name="javadoc" depends="java2html">

           

        </target>

      

        <!

    將build/dudu下的文件拷貝到tomcat-home/webapps/dudu/,包括完整的目錄和所有的

    Jsp文件,但不包括jar文件和WEB-INF/classes中的文件,也不包括web.xml文件和

    spring的配置文件這些文件不在build/dudu目錄下.

    -->

        <target name="deploy-web" depends="stage-web" if="tomcat.home">

           

        </target>

        <!部署web應(yīng)用,并解包war文件-->

        <target name="deploy" depends="package-web" if="tomcat.home">

            <unwar src="http://dev.csdn.net/article/"${webapp.dist}/${webapp.war}"

                dest="${tomcat.home}/webapps/${webapp.name}"/>

        </target>

        <!刪除web應(yīng)用 -->

        <target name="undeploy" if="tomcat.home">

            <delete file="${tomcat.home}/webapps/${webapp.war}"/>

            <delete dir="${tomcat.home}/webapps/${webapp.name}"/>

        </target>

     

     

        <!將war文件拷貝到tomcat容器-->

        <target name="deploy-war" depends="package-web" if="tomcat.home">

            <copy file="${webapp.dist}/${webapp.war}"

                todir="${tomcat.home}/webapps"/>

        </target>

       </project>

     

     

    Ø properties.xml文件分析

    該文件定義build.xml所需的屬性值。

    <!導(dǎo)入lib.properties 文件,其中包括了構(gòu)建時(shí)所需的jar文件定義-->

    <property name="lib.dir" location="lib"/>

    <property file="${lib.dir}/lib.properties"/>

    <!加載build.properties 文件-->

    <property file="build.properties"/>

    <!加載運(yùn)行unit tests所需的tomcat配置屬性文件 -->

    <property file="tomcat.properties"/>

    <!-- webapp.name被定義在build.properties,在此做檢查看該屬性是否被定義-->

    <target name="build.properties.missing" unless="webapp.name">

        <fail message="missing build.properties file in current directory or in ${user.home}"/>

    </target>

    <!如果build.properties 不存在時(shí),定義數(shù)據(jù)庫的基本配置-->

    <property name="database.jar" location="${mysql.jar}"/>

    <!定義建立數(shù)據(jù)庫時(shí)所用到的database URL,它被用在db-create任務(wù)中-->

    <property name="database.url"

        value="jdbc:mysql://localhost/jpetstore"/>

    <!通過build.properties 產(chǎn)生database.properties 文件-->

    <!由于build.properties 中的屬性被注釋了,所以這些屬性會(huì)從properties.xml中取得-->

    <target name="generate.database.properties">

        <propertyfile comment="Hibernate Configuration for JUnit tests"

            file="${basedir}/database.properties">

            <entry key="hibernate.dialect" value="${hibernate.dialect}"/>

           

         </propertyfile>

    </target>

    <!初始化屬性值-->

    <property environment="env"/>

    <property name="env.COMPUTERNAME" value="${env.HOSTNAME}"/>

    <!properties.xml文件的主要工作:定義構(gòu)建工具需要的Classpath屬性-->

    <path id="xdoclet.classpath">

       

    </path>

    <path id="hibernate.classpath">

    </path>

    <path id="dao.compile.classpath">

       

    </path>

    <path id="dao.test.classpath">

    </path>

    <path id="service.compile.classpath">

    </path>

    <path id="service.test.classpath">

       

    </path>

    <path id="web.compile.classpath">

       

    </path>

    <path id="web.test.classpath">

       

    </path>

      

    Ø app-settings.xml文件分析

    該文件定義設(shè)置應(yīng)用程序狀態(tài)的一些屬性值

    <property name="encrypt.password" value="true"/>

    <property name="encrypt.algorithm" value="SHA"/>

    <property name="secure.login" value="false"/>

    <property name="secure.application" value="false"/>

    <property name="rememberMe.enabled" value="true"/>

     

     

    Øbuild.properties文件分析

    build.compiler=modern

    webapp.name=dudu

    webapp.version=1.7

    webapp.war=${webapp.name}.war

    compile.deprecation=true

    build.dir=${basedir}/build

    dist.dir=${basedir}/dist

    test.dir=${build.dir}/test

    javac.debug=true

    junit.fork=true

    xdoclet.force=false

    error.mailTo=junk@raibledesigns.com

    error.mailHost=localhost

    error.server=localhost

    ftp.server=upload.sourceforge.net

    ftp.remoteDir=incoming

    ftp.user=anonymous

    Ø tomcat.properties文件分析

    tomcat.server=localhost

    tomcat.manager.url=http://${tomcat.server}:8080/manager

    tomcat.username=admin

    tomcat.password=admin

    posted on 2008-05-08 19:40 常言笑 閱讀(467) 評論(0)  編輯  收藏 所屬分類: JAVA/J2EE

    My Links

    Blog Stats

    常用鏈接

    留言簿(5)

    隨筆分類

    隨筆檔案

    搜索

    積分與排名

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 中文字幕在线日亚洲9| 在线观看亚洲成人| 成年性生交大片免费看| 无人在线观看免费高清视频| 黄页网站免费观看| 免费可以看黄的视频s色| 成年网站免费视频A在线双飞| 114一级毛片免费| 成人免费一区二区三区在线观看| 女人张开腿等男人桶免费视频| 德国女人一级毛片免费| 在线免费不卡视频| 又粗又大又猛又爽免费视频| 亚洲日韩中文在线精品第一| 亚洲中文久久精品无码| 亚洲成人中文字幕| 亚洲91精品麻豆国产系列在线 | 成人网站免费观看| 噜噜嘿在线视频免费观看| 国产黄色片在线免费观看| 亚洲另类少妇17p| 国产aⅴ无码专区亚洲av| 99ri精品国产亚洲| 亚洲精品福利你懂| 黄人成a动漫片免费网站| fc2免费人成在线| 污污网站免费观看| 日韩免费a级毛片无码a∨| 国产精品无码免费视频二三区| 亚洲无码精品浪潮| 日韩精品一区二区亚洲AV观看| 亚洲一级在线观看| 黄网站在线播放视频免费观看 | 黄色免费网站在线看| 免费高清国产视频| 黄色片在线免费观看| 亚洲国产精品自在拍在线播放| 婷婷亚洲久悠悠色悠在线播放| 亚洲精华液一二三产区| 手机看片国产免费永久| 免费a级毛片无码a∨蜜芽试看|