Search code examples
gradlejooq

Could not find or load main class org.jooq.codegen.GenerationTool with gradle-jooq-plugin-3.0.1, jooq-3.11.2


I have a project using gradle-jooq-plugin-3.0.1, jooq-3.11.2 and Spring Boot 1. When I try to generate JOOQ-Files I get the following error message:

> Task :generateSampleJooqSchemaSource FAILED
Error: Could not find or load main class org.jooq.codegen.GenerationTool

This is a minified build file:

plugins {
  id 'nu.studer.jooq' version '3.0.1'
  id 'org.springframework.boot' version '1.5.14.RELEASE'
  id 'java'
}

repositories {
  mavenCentral()
}

dependencies {
  jooqRuntime 'com.h2database:h2:1.4.177'
  compile 'org.jooq:jooq'
}

bootRepackage.enabled = false

jooq {
  version = '3.11.2'

  sample(sourceSets.main) {
    jdbc {
      driver = 'org.h2.Driver'
      url = 'jdbc:h2:~/test-gradle'
      user = 'sa'
      password = ''
    }
    generator {
      database {}
      target {
        packageName = 'org.jooq.example.gradle.db'
      }
    }
  }

}

Any ideas? According to gradle-jooq-plugin/README.md this should be working.


Solution

  • The plugin seems to ignore the configured version (3.11.2) and uses the version from Spring Boot (3.9.6). org.jooq.codegen.GenerationTool was introduced only with JOOQ-3.11.0.

    As a workaround you can override Spring Boot's JOOQ version:

    ext['jooq.version'] = '3.11.2'
    

    I've reported an issue for it: gradle-jooq-plugin/issues/81