alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code

<!--
     This build script assumes that the source code of your web application
     is organized into the following subdirectories underneath the source
     code directory from which you execute the build script:

        docs                 Static documentation files to be copied to
                             the "docs" subdirectory of your distribution.

        src                  Java source code (and associated resource files)
                             to be compiled to the "WEB-INF/classes"
                             subdirectory of your web applicaiton.

     $Id: build.xml,v 1.9 2005/01/28 07:52:19 minhnn Exp $
-->
<project name="MyVietnam" default="compile" basedir=".">

    <!-- ===================== Property Definitions =========================== -->
    <property file="build.properties"/>
    <property file="${user.home}/build.properties"/>

    <!-- ==================== File and Directory Names ======================== -->
    <property name="app.name" value="myvietnam"/>
    <property name="app.version" value="1.7.0"/>

    <property name="build.home" value="${basedir}/build"/>
    <property name="dist.home" value="${build.home}/dist"/>
    <property name="release.home" value="${build.home}/release"/>
    <property name="javadoc.home" value="${build.home}/javadoc"/>

    <property name="docs.home" value="${basedir}/docs"/>
    <property name="src.home" value="${basedir}/src"/>
    <property name="lib.home" value="${basedir}/lib"/>
    <property name="sql.home" value="${basedir}/sql"/>
    <property name="i18n.home" value="${basedir}/i18n"/>
    <property name="properties.home" value="${basedir}/properties"/>

    <!--  ==================== Compilation Control Options ==================== -->
    <!--
    These properties control option settings on the Javac compiler when it
    is invoked using the <javac> task.
    
    compile.debug        Should compilation include the debug option?
    
    compile.deprecation  Should compilation include the deprecation option?
    
    compile.optimize     Should compilation include the optimize option?
    -->
    <property name="compile.debug" value="true"/>
    <property name="compile.deprecation" value="false"/>
    <property name="compile.optimize" value="true"/>

    <taskdef name="mvnforumfinder" classpath="${i18n.home}/tool/mvntools.jar" classname="LocalizingKeyFinder"/>

    <!-- ==================== Compilation Classpath =========================== -->
    <!--
    Rather than relying on the CLASSPATH environment variable, Ant includes
    features that makes it easy to dynamically construct the classpath you
    need for each compilation.  The example below constructs the compile
    classpath to include the servlet.jar file, as well as the other components
    that Tomcat makes available to web applications automatically, plus anything
    that you explicitly added.
    -->
    <path id="compile.classpath">
        <fileset dir="${lib.home}">
            <include name="*.jar"/>
        </fileset>
    </path>

    <!-- ==================== All Target ====================================== -->
    <!--
    The "all" target is a shortcut for running the "clean" target followed
    by the "compile" target, to force a complete recompile.
    -->
    <target name="all" depends="clean,compile" description="Clean build and dist directories, then compile"/>

    <!-- ==================== Clean Target ==================================== -->
    <!--
    The "clean" target deletes any previous "build" and "dist" directory,
    so that you can be ensured the application can be built from scratch.
    -->
    <target name="clean" description="Delete old build and dist directories">
        <delete dir="${build.home}"/>
        <delete dir="${dist.home}"/>
    </target>

    <!-- ==================== Prepare Target ================================== -->
    <!--
    The "prepare" target is used to create the "build" destination directory,
    and copy the static contents of your web application to it.  If you need
    to copy static files from external dependencies, you can customize the
    contents of this task.
    
    Normally, this task is executed indirectly when needed.
    -->
    <target name="prepare">
        <mkdir dir="${build.home}"/>

        <mkdir dir="${build.home}/i18n"/>
        <copy file="${i18n.home}/mvncore_java_i18n.properties" todir="${build.home}/i18n"/>
        <copy file="${i18n.home}/mvncore_java_i18n.properties" tofile="${build.home}/i18n/mvncore_java_i18n_en.properties"/>
        <native2ascii encoding="Cp1256" src="${i18n.home}" dest="${build.home}/i18n" includes="mvncore_java_i18n_ar.properties"/>
        <native2ascii encoding="Cp1251" src="${i18n.home}" dest="${build.home}/i18n" includes="mvncore_java_i18n_bg.properties"/>
        <native2ascii encoding="ISO8859_1" src="${i18n.home}" dest="${build.home}/i18n" includes="mvncore_java_i18n_da.properties"/>
        <native2ascii encoding="ISO8859_1" src="${i18n.home}" dest="${build.home}/i18n" includes="mvncore_java_i18n_de.properties"/>
        <native2ascii encoding="ISO8859_7" src="${i18n.home}" dest="${build.home}/i18n" includes="mvncore_java_i18n_el.properties"/>
        <native2ascii encoding="Cp1252" src="${i18n.home}" dest="${build.home}/i18n" includes="mvncore_java_i18n_es.properties"/>
        <native2ascii encoding="Cp1252" src="${i18n.home}" dest="${build.home}/i18n" includes="mvncore_java_i18n_fr.properties"/>
        <native2ascii encoding="ISO8859_1" src="${i18n.home}" dest="${build.home}/i18n" includes="mvncore_java_i18n_it.properties"/>
        <native2ascii encoding="MS932" src="${i18n.home}" dest="${build.home}/i18n" includes="mvncore_java_i18n_ja.properties"/>
        <native2ascii encoding="utf-8" src="${i18n.home}" dest="${build.home}/i18n" includes="mvncore_java_i18n_ko.properties"/>
        <native2ascii encoding="Cp1257" src="${i18n.home}" dest="${build.home}/i18n" includes="mvncore_java_i18n_lv.properties"/>
        <native2ascii encoding="ISO8859_1" src="${i18n.home}" dest="${build.home}/i18n" includes="mvncore_java_i18n_nl.properties"/>
        <native2ascii encoding="ISO8859_1" src="${i18n.home}" dest="${build.home}/i18n" includes="mvncore_java_i18n_no.properties"/>
        <native2ascii encoding="ISO8859_1" src="${i18n.home}" dest="${build.home}/i18n" includes="mvncore_java_i18n_pt_BR.properties"/>
        <native2ascii encoding="Cp1251" src="${i18n.home}" dest="${build.home}/i18n" includes="mvncore_java_i18n_ru.properties"/>
        <native2ascii encoding="Cp1250" src="${i18n.home}" dest="${build.home}/i18n" includes="mvncore_java_i18n_sh.properties"/>
        <native2ascii encoding="ISO8859_2" src="${i18n.home}" dest="${build.home}/i18n" includes="mvncore_java_i18n_si.properties"/>
        <native2ascii encoding="Cp1251" src="${i18n.home}" dest="${build.home}/i18n" includes="mvncore_java_i18n_sr.properties"/>
        <native2ascii encoding="Cp1254" src="${i18n.home}" dest="${build.home}/i18n" includes="mvncore_java_i18n_tr.properties"/>
        <native2ascii encoding="utf-8" src="${i18n.home}" dest="${build.home}/i18n" includes="mvncore_java_i18n_vi.properties"/>
        <native2ascii encoding="GB2312" src="${i18n.home}" dest="${build.home}/i18n" includes="mvncore_java_i18n_zh_CN.properties"/>
        <native2ascii encoding="Big5" src="${i18n.home}" dest="${build.home}/i18n" includes="mvncore_java_i18n_zh_TW.properties"/>
    </target>

    <!-- ==================== Compile Target ================================== -->
    <!--
    The "compile" target transforms source files (from your "src" directory)
    into object files in the appropriate location in the build directory.
    This example assumes that you will be including your classes in an
    unpacked directory hierarchy under "/WEB-INF/classes".
    -->
    <target name="compile" depends="prepare" description="Compile Java sources">
        <mkdir dir="${build.home}/classes"/>
        <javac srcdir="${src.home}" destdir="${build.home}/classes" debug="${compile.debug}" deprecation="${compile.deprecation}" optimize="${compile.optimize}">
            <classpath refid="compile.classpath"/>
        </javac>
        <mkdir dir="${build.home}/lib"/>
        <jar destfile="${build.home}/lib/myvietnam.jar" basedir="${build.home}/classes"/>
    </target>

    <!-- ==================== Javadoc Target ================================== -->
    <!--
    The "javadoc" target creates Javadoc API documentation for the Java
    classes included in your application.  Normally, this is only required
    when preparing a distribution release, but is available as a separate
    target in case the developer wants to create Javadocs independently.
    -->
    <target name="javadoc" depends="compile" description="Create Javadoc API documentation">
        <mkdir dir="${javadoc.home}"/>
        <javadoc sourcepath="${src.home}" destdir="${javadoc.home}" packagenames="*">
            <classpath refid="compile.classpath"/>
        </javadoc>
    </target>

    <!-- ==================== Dist Target ===================================== -->
    <!--
    The "dist" target creates a binary distribution of your application
    in a directory structure ready to be archived in a tar.gz or zip file.
    Note that this target depends on two others:
    
    * "compile" so that the entire web application (including external
    dependencies) will have been assembled
    
    * "javadoc" so that the application Javadocs will have been created
    -->
    <target name="dist" depends="compile,find-java-wrong-keys,javadoc" description="Create binary distribution">
        <mkdir dir="${dist.home}"/>
        <mkdir dir="${dist.home}/docs"/>
        <copy todir="${dist.home}/docs">
            <fileset dir="${docs.home}"/>
        </copy>
        <copy todir="${dist.home}/docs/api">
            <fileset dir="${javadoc.home}"/>
        </copy>
        <mkdir dir="${dist.home}/sql"/>
        <copy todir="${dist.home}/sql">
            <fileset dir="${sql.home}"/>
        </copy>
        <mkdir dir="${dist.home}/properties"/>
        <copy todir="${dist.home}/properties">
            <fileset dir="${properties.home}"/>
        </copy>
        <mkdir dir="${dist.home}/lib"/>
        <copy todir="${dist.home}/lib">
            <fileset dir="${build.home}/lib"/>
            <fileset dir="${lib.home}"/>
        </copy>
    
        <!-- Create application JAR file -->
        <mkdir dir="${release.home}"/>
        <jar destfile="${release.home}/myvietnam-${app.version}.zip" basedir="${dist.home}"/>
    </target>
        
    <target name="find-java-wrong-keys" depends="prepare" description="Find wrong keys in JAVA source files">
        <mvnforumfinder starttoken="MVNCoreResourceBundle.getString" endtoken=");" bundle="${i18n.home}/mvncore_java_i18n">
            <fileset dir="${src.home}">
                <include name="**/*.java"/>
            </fileset>
        </mvnforumfinder>
        <mvnforumfinder starttoken="MVNCoreResourceBundle.getString" endtoken=");" bundle="${i18n.home}/mvncore_java_i18n_bg">
            <fileset dir="${src.home}">
                <include name="**/*.java"/>
            </fileset>
        </mvnforumfinder>
        <mvnforumfinder starttoken="MVNCoreResourceBundle.getString" endtoken=");" bundle="${i18n.home}/mvncore_java_i18n_da">
            <fileset dir="${src.home}">
                <include name="**/*.java"/>
            </fileset>
        </mvnforumfinder>
        <mvnforumfinder starttoken="MVNCoreResourceBundle.getString" endtoken=");" bundle="${i18n.home}/mvncore_java_i18n_de">
            <fileset dir="${src.home}">
                <include name="**/*.java"/>
            </fileset>
        </mvnforumfinder>
        <mvnforumfinder starttoken="MVNCoreResourceBundle.getString" endtoken=");" bundle="${i18n.home}/mvncore_java_i18n_fr">
            <fileset dir="${src.home}">
                <include name="**/*.java"/>
            </fileset>
        </mvnforumfinder>
        <mvnforumfinder starttoken="MVNCoreResourceBundle.getString" endtoken=");" bundle="${i18n.home}/mvncore_java_i18n_lv">
            <fileset dir="${src.home}">
                <include name="**/*.java"/>
            </fileset>
        </mvnforumfinder>
        <mvnforumfinder starttoken="MVNCoreResourceBundle.getString" endtoken=");" bundle="${i18n.home}/mvncore_java_i18n_nl">
            <fileset dir="${src.home}">
                <include name="**/*.java"/>
            </fileset>
        </mvnforumfinder>
        <mvnforumfinder starttoken="MVNCoreResourceBundle.getString" endtoken=");" bundle="${i18n.home}/mvncore_java_i18n_vi">
            <fileset dir="${src.home}">
                <include name="**/*.java"/>
            </fileset>
        </mvnforumfinder>
        <mvnforumfinder starttoken="MVNCoreResourceBundle.getString" endtoken=");" bundle="${i18n.home}/mvncore_java_i18n_zh_CN">
            <fileset dir="${src.home}">
                <include name="**/*.java"/>
            </fileset>
        </mvnforumfinder>
        <mvnforumfinder starttoken="MVNCoreResourceBundle.getString" endtoken=");" bundle="${i18n.home}/mvncore_java_i18n_zh_TW">
            <fileset dir="${src.home}">
                <include name="**/*.java"/>
            </fileset>
        </mvnforumfinder>
    </target>

    <!-- ==================== CVS Target ===================================== -->
    <!--
    Check out the CVS
    -->
    <target name="cvs">
        <echo>Updating module MyVietnam
        <cvs command="update" dest="${basedir}"/>
    </target>

</project>
... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.