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

Whitespace (newlines and indentation)

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

By default, jOOQ's code generator produces unix newline characters (\n) and 4 space indentation (Java) or 2 space indentation (Scala). This can be overridden by using the below configuration flags. Depending on how you're loading the configuration, whitespace characters may get lost, which is why you may need to escape the backslash \ to \\. Supported escape sequences include:

  • Indentation: \t (tab) and \s (whitespace)
  • Newline: \r (carriage return) and \n (newline)

XML configuration (standalone and Maven)

<configuration xmlns="">

Programmatic configuration

new org.jooq.meta.jaxb.Configuration()
  .withGenerator(new Generator(
    .withGenerate(new Generate()

Gradle configuration

myConfigurationName(sourceSets.main) {
  generator {
    generate {
      indentation = '\\s\\t'
      newline = '\\r\\n'
The jOOQ Logo