New versions: Dev (3.14) | Latest (3.13) | 3.12 | 3.11 | 3.10 | 3.9 | 3.8 | Old versions: 3.7 | 3.6 | 3.5 | 3.4

Running the code generator with Maven

Applies to ✅ Open Source Edition   ✅ Express Edition   ✅ Professional Edition   ✅ Enterprise Edition

There is no substantial difference between running the code generator with Maven or in standalone mode. Both modes use the exact same <configuration/> element. The Maven plugin configuration adds some additional boilerplate around that:

<plugin>
  <!-- Specify the maven code generator plugin -->
  <!-- Use org.jooq              for the Open Source edition
           org.jooq.pro          for commercial editions, 
           org.jooq.pro-java-8   for commercial editions with Java 8 support,
           org.jooq.pro-java-6   for commercial editions with Java 6 support,
           org.jooq.trial        for the free trial edition,
           org.jooq.trial-java-8 for the free trial edition with Java 8 support, 
           org.jooq.trial-java-6 for the free trial edition with Java 6 support
         
       Note: Only the Open Source Edition is hosted on Maven Central. 
             Import the others manually from your distribution -->
  <groupId>org.jooq</groupId>
  <artifactId>jooq-codegen-maven</artifactId>
  <version>3.13.4</version>

  <executions>
    <execution>
      <id>jooq-codegen</id>
      <phase>generate-sources</phase>
      <goals>
        <goal>generate</goal>
      </goals>
      <configuration>
        ...
      </configuration>
    </execution>
  </executions>
</plugin>

Additional Maven-specific flags

There are, however, some additional, Maven-specific flags that can be specified with the jooq-codegen-maven plugin only:

<plugin>
  <configuration>

    <!-- A boolean property (or constant) can be specified here to tell the plugin not to do anything -->
    <skip>${skip.jooq.generation}</skip>

    <!-- Instead of providing an inline configuration here, you can specify an external XML configuration file here -->
    <configurationFile>${externalfile}</configurationFile>
    
    <!-- Alternatively, you can provide several external configuration files. These will be merged by using
         Maven's combine.children="append" policy -->
    <configurationFiles>
      <configurationFile>${file1}</configurationFile>
      <configurationFile>${file2}</configurationFile>
      <configurationFile>...</configurationFile>
    </configurationFiles>
  </configuration>
</plugin>
The jOOQ Logo