New versions: Dev (3.14) | Latest (3.13)

LiquibaseDatabase: Code generation from Liquibase XML files

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

If you are using Liquibase, you will have defined your database as a set of Liquibase change sets, in XML. That database definition is complete and self contained, and can easily be used as a source of meta information by the jOOQ code generator.

For example, the following database.xml script could be used:

<?xml version="1.0" encoding="UTF-8"?>
    <changeSet author="authorName" id="changelog-1.0">
        <createTable tableName="MY_TABLE">
            <column name="MY_COLUMN" type="TEXT">
                <constraints nullable="true" primaryKey="false" unique="false" />

In order to use the above as a source of jOOQ's code generator, you will simply need to set up your code generation configuration as follows:

XML configuration (standalone and Maven)

<configuration xmlns="">
        <!-- Specify the location of your XML script. -->
        <!-- Whether you want to include liquibase tables in generated output
             - false (default)
             - true: includes DATABASECHANGELOG and DATABASECHANGELOGLOCK tables -->
        <!-- Properties prefixed "database." will be passed on to the liquibase.database.Database class 
             if a matching setter is found -->
        <!-- The property "changeLogParameters.contexts" will be passed on to the 
             liquibase.database.Database.update() call (jOOQ 3.13.2+).
             See -->

Programmatic configuration

new org.jooq.meta.jaxb.Configuration()
  .withGenerator(new Generator(
    .withDatabase(new Database()
        new Property()
        new Property()
        new Property()

Gradle configuration

myConfigurationName(sourceSets.main) {
  generator {
    database {
      name = 'org.jooq.meta.extensions.liquibase.LiquibaseDatabase'
      properties {
        property {
          key = 'scripts'
          value = 'src/main/resources/database.xml'
        property {
          key = 'includeLiquibaseTables'
          value = 'false'
        property {
          key = 'database.liquibaseSchemaName'
          value = 'lb'


Note that the org.jooq.meta.extensions.liquibase.LiquibaseDatabase class is located in an external dependency, which needs to be placed on the classpath of the jOOQ code generator. E.g. using Maven:

  <!-- Use org.jooq              for the Open Source edition
           for commercial editions, 
    for commercial editions with Java 8 support,
    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 -->

    <!-- The artifactId has been renamed to jooq-meta-extensions-liquibase in jOOQ 3.14 -->
The jOOQ Logo