I needed Velocity for a new project (I had used it once briefly more than a 
year ago) and I started as I usually do by trying to run the examples.

The existing .bat files will not work on Windows 2000 because they can't 
create a proper path containing all the files in build/lib (and I'm not 
really sure that is what you want anyway). So I thought it might be better 
to just dump the .sh and .bat files in the various example directories and 
just go with an ant file to run most of the examples. The provided file will 
run app_example1, app_example2, event_example, logger_example, and 
xmlapp_example (if you put xerces.jar from jdom into your build/lib 
directory, it seems to be missing). Running the examples this way is 
considerably cleaner than what is there now, easier to maintain, and it will 
work cross-platform just like the build scripts do.

Note: This assumes you've already done "ant examples" from the build 
directory in order to get everything built. Just cut out the following and 
put it in the root directory of the project and type "ant -buildfile 
examples.xml" to get it to run all five examples.

John Munsch
http://www.johnmunsch.com

==================== >8 cut here - examples.xml ====================
<?xml version="1.0"?>
<project name="examples" basedir="." default="all">
    <target name="app_example1" description="This simple example shows how 
to use the Velocity Template Engine
in a standalone program.">
        <java classname="Example" dir="./examples/app_example1" fork="true">
            <arg value="Example.vm"/>
            <classpath>
                <pathelement location="./bin/velocity-dep-1.3-rc1.jar" />
                <pathelement location="./examples/app_example1" />
            </classpath>
        </java>
    </target>

    <target name="app_example2" description="Another simple example showing 
how to use Velocity in a standalone
program.">
        <java classname="Example2" dir="./examples/app_example2" 
fork="true">
            <classpath>
                <pathelement location="./bin/velocity-dep-1.3-rc1.jar" />
                <pathelement location="./examples/app_example2" />
            </classpath>
        </java>
    </target>

    <target name="event_example" description="This is a more advanced 
example, and shows how to use the event handling
features of Velocity.">
        <java classname="EventExample" dir="./examples/event_example" 
fork="true">
            <classpath>
                <pathelement location="./bin/velocity-dep-1.3-rc1.jar" />
                <pathelement location="./examples/event_example" />
            </classpath>
        </java>
    </target>

    <target name="logger_example" description="This is a toy program to show 
how any class can be used as a logging
facility with Velocity.">
        <java classname="LoggerExample" dir="./examples/logger_example" 
fork="true">
            <classpath>
                <pathelement location="./bin/velocity-dep-1.3-rc1.jar" />
                <pathelement location="./examples/logger_example" />
            </classpath>
        </java>
    </target>

    <target name="xmlapp_example" description="This is simple example that 
demonstrates direct access of XML data via
Velocity templates, as well as Velocimacro recursion.">
        <java classname="XMLTest" dir="./examples/xmlapp_example" 
fork="true">
            <arg value="xml.vm"/>
            <classpath>
                <pathelement location="./bin/velocity-dep-1.3-rc1.jar" />
                <pathelement location="./examples/xmlapp_example" />
                <pathelement location="./build/lib/jdom-b7.jar" />
                <pathelement location="./build/lib/xerces.jar" />
            </classpath>
        </java>
    </target>

    <target name="all" 
depends="app_example1,app_example2,event_example,logger_example,xmlapp_example" 
/>
</project>


_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to