db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Greg Monroe" <Greg.Mon...@DukeCE.com>
Subject RE: Building under Windows
Date Tue, 25 Oct 2005 18:51:13 GMT
OK, here's some quick start info and other places to look.

First, included in the 3.1 & 3.2-RCx Generator releases (but 
not 3.1.1!), is the following set of files:

torque-build.xml (<= main Torque Ant build tasks)
build.properties (<= Properties file with project 
                     specific settings)
default.properties (<= defines default directory locations and 
                       other stuff)

All these files are fairly well documented with comments, so 
take a look at them to learn what is what.  In general, you 
should only change the build.properties file to define your 
project, since this is included in the build-torque.xml file 
before any defaults are set.

In addition to the comments, there is also a couple of good
reference pages on the torque site about these properties.

First, Step 2 of the tutorial applies to both ant and maven,
just use build.properties for ant instead of Maven's 
project.properties:

http://db.apache.org/torque/runtime/tutorial/step2.html

Then there is the properties reference on the torque site at:

http://db.apache.org/torque/generator/properties-reference.html

This details all the build.properties items you can set to change
the Torque build environment.  You probably need to look closely
at the various directory settings to understand the default 
directories and how to move them around to match your project
settings in the build.properties file.  The defaults Ant settings
are documented in the Generator with the Ant Build file section of
this document:

http://db.apache.org/torque/runtime/user-guide.html


Once you have everything set up and a schema defined, you can 
generate your Torque db classes using:

    ant -f torque-build.xml

To see the targets that represent other Torque functions use:  

    ant -f torque-build.xml -projecthelp 

This is also somewhat documented in the older 3.1 release tutorials 
located at:

http://db.apache.org/torque/releases/torque-3.1/tutorial/step3.html

As an example of how to integrate Torque into an larger project build, 
here's what I do for my projects that use Torque.

I generally lay out my projects with a directory structure like:

project
   /src
       /java   <= Java source
       /sql    <= SQL scripts, etc.
       /schema <= Torque schema files
   /bin
       /classes   <= Compiled classes
          Torque.properties <= Runtime properties used for testing, etc.
   /lib <= Runtime libraries needed by project (e.g. Torque Runtime
stuff).
   /build
       build.xml  <= Main project build file
       /lib       <= Libs needed only during build (sans torque libs)
       /torque    <= basically the gen distro expanded here
          torque-build.xml
          build.properties
          default.properties
          /lib  <= Torque gen libs
          /docs
          /master
          /schema

In the project build.xml file, I add a dependency to the compile 
target called om.  Then I add the following targets to the build
file to call Torque if needed.

<!-- ===================================================================
-->
<!-- Object Model
-->
<!-- ===================================================================
-->
       <target name="check_om">
         <uptodate property="omBuild.notRequired"
targetfile="${src.sql.dir}/${torque.schema.name}.sql">
           <srcfiles dir= "${src.dir}/schema"
includes="${torque.schema.name}.xml"/>
           <srcfiles dir= "./build/torque" includes="build.properties"/>
         </uptodate>
       </target>
       
       <target name="om" depends="check_om"
               unless="omBuild.notRequired"
               description="Generate Object Model sources">
       
         <ant antfile="build.xml" dir="./build/torque">
             <property name="build.properties"
value="build.properties"/>
         </ant>
       
       </target>

In torque's build.properties, I make sure to set the following 
(in addition to all the project and db info)

torque.home = .

torque.output.dir = ${torque.home}/../../src

torque.schema.dir = ${torque.output.dir}/schema
torque.java.dir = ${torque.output.dir}/java
torque.sql.dir = ${torque.output.dir}/sql

#  Compile target directories

src.dir = ${torque.java.dir}
build.dest = ${outputDirectory}/../bin/classes 

Many variations on this theme are possible. This should get
you started using ant instead of maven.

Greg

> -----Original Message-----
> From: Jakub Piechnik [mailto:piechutm@wp.pl] 
> 
> Yes - I would be very grateful for information how to use 
> torque with Ant.
> 
> Regards
> Jakub Piechnik
> 

Duke CE Privacy Statement
Please be advised that this e-mail and any files transmitted with it are confidential communication
or may otherwise be privileged or confidential and are intended solely for the individual
or entity to whom they are addressed.  If you are not the intended recipient you may not rely
on the contents of this email or any attachments, and we ask that you  please not read, copy
or retransmit this communication, but reply to the sender and destroy the email, its contents,
and all copies thereof immediately.  Any unauthorized dissemination, distribution or copying
of this communication is strictly prohibited.



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message