All versions: 3.11 | 3.10 | 3.9 | 3.8 | 3.7 | 3.6 | 3.5 | 3.4 | Development versions: 3.12

Run generation with Ant

When running code generation with ant's <java/> task, you may have to set fork="true":

<!-- Run the code generation task -->
<target name="generate-test-classes">
  <java fork="true" 
        classname="org.jooq.codegen.GenerationTool">
    <arg value="/path/to/configuration.xml"/>
    <classpath>
      <pathelement location="/path/to/jooq-3.11.4.jar"/>
      <pathelement location="/path/to/jooq-meta-3.11.4.jar"/>
      <pathelement location="/path/to/jooq-codegen-3.11.4.jar"/>
    </classpath>  
  </java>
</target>

Using the Ant Maven plugin

Sometimes, ant can be useful to work around a limitation (misunderstanding?) of the Maven build. Just as with the above standalone ant usage example, the jOOQ code generator can be called from the maven-antrun-plugin:

<!-- Run the code generation task -->
<plugin>
  <artifactId>maven-antrun-plugin</artifactId>
  <version>1.8</version>
  <executions>
    <execution>
      <phase>generate-sources</phase>
      <configuration>
        <tasks>
          <java fork="true" 
                classname="org.jooq.codegen.GenerationTool"
                classpathref="maven.compile.classpath">
              <arg value="/path/to/configuration.xml"/>
          </java>
       </tasks>
      </configuration>
      <goals>
        <goal>run</goal>
      </goals>
    </execution>
  </executions>
                
  <dependencies>
    <dependency>
      <!-- JDBC driver -->
    </dependency>
    <dependency>
      <!-- Use org.jooq            for the Open Source Edition
               org.jooq.pro        for commercial editions, 
               org.jooq.pro-java-6 for commercial editions with Java 6 support,
               org.jooq.trial      for the free trial edition 
                 
           Note: Only the Open Source Edition is hosted on Maven Central. 
                 Import the others manually from your distribution -->
      <groupId>org.jooq.trial</groupId>
      <artifactId>jooq-codegen</artifactId>
      <version>3.11.4</version>
    </dependency>
  </dependencies>
</plugin>
The jOOQ Logo