Introduction

Torque projects used to be built with all of the Torque elements (templates, property files, build-torque.xml, etc.) locally installed in each project's source tree.

The advent of Maven allows Torque to be used in a much simpler manner. With the Maven plugin, absolutely no Torque-related resources (except the Torque jar file iteself) are required to be locally installed in each project. Instead, the plugin will automatically download any required resources for you.

Installation

The maven plugin is installed thus:

Building from Source

Building the maven plugin from source is relatively easy - you might want to do this if there are fixes or enhancements in CVS that you want to make use of. Another reason you might want to do this is if you wish to make your own copy of the plugin that includes a set of customized generator templates to modify the object model class files that will be produced.

The first thing to do is to check out Torque from CVS (make sure you use branch tag you desire). If you want to modify any of the generator templates you would do this before running maven plugin:install from the src/maven-plugin directory. This will jar together the various plugin files copy it into your ${maven.home}/plugins directory.

For consistency you should also install the corresponding generator and runtime jars in your local maven repository by running maven jar:install from the src/generator and src directories respectively.

Configuration

The Torque Maven plugin is configured via properties defined in your project.properties file. See the properties reference for details on the various properties that can be configured.

project.properties

Instead of relying on the typical build.properties, the Maven plugin uses the project-wide settings in the project.properties file.

The Torque settings in project.properties follow the same format as they would in the old build.properties except the default directories are different to better fit a maven-ized project.

Here is a sample configuration from project.properties:

Other Tips

If you run into problems, try the following tips:

  • Don't place your project-schema.xml file in a directory with other files. This can lead to various DTD errors.