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

Currently you must manually build the plugin by checking out Torque from CVS and running maven plugin:install from the src/generator/src/maven-plugin directory. This will jar together the various plugin files copy it into your ${maven.home}/plugins directory.

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 project settings...

# -------------------------------------------------------------------
#
#  T O R Q U E   S E T T I N G S
#
# -------------------------------------------------------------------

torque.project = yourproject
torque.database = mysql

torque.database.createUrl = jdbc:mysql://localhost:3306/
torque.database.buildUrl = jdbc:mysql://localhost:3306/yourprojectdb
torque.database.url = jdbc:mysql://localhost:3306/yourprojectdb
torque.database.driver = org.gjt.mm.mysql.Driver
torque.database.user = user
torque.database.password = password
torque.database.host = localhost

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.