Ant tasks

Cayenne ships with Ant tasks that provide Ant frontend to a number of useful operations in Cayenne. These tasks are part of the cayenne-tools JAR. The following tasks are included:

  • cgen - Java class generator
  • cdbgen - Database schema generator
  • cdeploy - Deployment configurator (deprecated; will be removed after 3.0)
  • cdataport - Data porting tool.
  • cdbimport - Database schema importer.

Importing Cayenne Tasks in build.xml

All Cayenne tasks above can be imported at once with "typedef". First a user needs to define Classpath structure to include cayenne-tools and a few depdendencies. Here they are shown relative to the Cayenne distro folder. In a real project they may be copied to the appropriate project folders and referenced accordingly:

<path id="classpath">
   <fileset dir="lib" >
      <include name="cayenne-tools-X.X.jar" />
      <include name="cayenne-server-X.X.jar" />
      <include name="third-party/vpp-2.2.1.jar" />
   </fileset>
</path>

And then import all tasks with "typedef", referencing Antlib descriptor in Cayenne:

<typedef resource="org/apache/cayenne/tools/antlib.xml"> 
   <classpath refid="classpath"/> 
</typedef>

Sections

  1. cgen
  2. cdbgen
  3. cdeploy
  4. cdataport
  5. cdbimport