I currently have the problem that I cannot get the jooq Generator to run. As a template I used the example from Etienne Studer (see https://github.com/etiennestuder/gradle-jooq-plugin/tree/master/example/configure_toolchain_gradle_dsl). That means I am using Gradle and Java 17.
The payed Pro Libraries from jooq (I use a local postgresql DB) are located in a subfolder (lib) in the project (see line 11 in build.gradle file.
My gradle file looks like this:
import nu.studer.gradle.jooq.JooqEdition
plugins {
id 'nu.studer.jooq' version '8.0'
id 'java'
}
repositories {
mavenCentral()
flatDir {
dirs 'lib'
}
}
dependencies {
jooqGenerator 'org.postgresql:postgresql:42.5.0'
}
jooq {
version = '3.17.5'
edition = JooqEdition.PRO
configurations {
main {
generationTool {
logging = org.jooq.meta.jaxb.Logging.TRACE
jdbc {
driver = 'org.postgresql.Driver'
url = 'jdbc:postgresql://localhost:5432/postgres'
user = 'postgres'
password = 'blabla'
}
generator {
name = 'org.jooq.codegen.DefaultGenerator'
database {
name = 'org.jooq.meta.postgres.PostgresDatabase'
inputSchema = 'public'
}
generate {
deprecated = false
records = false
immutablePojos = false
fluentSetters = true
}
target {
packageName = 'solar.deinland.importxml.postgresql'
}
strategy.name = 'org.jooq.codegen.DefaultGeneratorStrategy'
}
}
}
}
}
The error message that I get when running the gradle task to generate the code is:
Error: Could not initialize main class org.jooq.codegen.GenerationTool
Reason: java.lang.NoClassDefFoundError: org/jooq/meta/SchemaVersionProvider
FAILURE: Build failed with an exception.
The above shown gradle task runs fine as long as I change the edition to JooqEdition.OSS. If I want to use the paid libs I run into the above mentioned error.
Is it ok just to place the libraries in a project subfolder and reference them as flatdir
? Or do I need to setup a local maven repository?
Thanks a lot for your help.
Cheers Knut
The problem was solved by running the "maven_install" batch script that is provided with the jooq libraries. This script registers the provided libraries to the local maven instance. Replacing the entry
with
gives gradle the oportunity to find them in the local maven repository.