I experience trouble to generate jooq classes. I use jooq 3.20.3, with maven, and a db that runs in background.
My configuration is as such:
<build>
<plugins>
<plugin>
<groupId>org.jooq</groupId>
<artifactId>jooq-codegen-maven</artifactId>
<version>${jooq.version}</version>
<executions>
<execution>
<id>jooq-codegen</id>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<jdbc>
<driver>org.postgresql.Driver</driver>
<url>jdbc:postgresql://localhost:5432/my_db</url>
<user>my_user</user>
<password>my_password</password>
</jdbc>
<generator>
<database>
<name>org.jooq.meta.postgres.PostgresDatabase</name>
</database>
<target>
<packageName>com.example.domain</packageName>
<directory>src/main/java_generated</directory>
</target>
</generator>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
I am not sure as of what is mandatory and what is optional. Also, I used the jooq configuration provided in the 'Getting Started'. Of course, the values of the my_db
and so on are the one of my DB (later I will use env variables of something).
But everytime I run mvn jooq-codegen:generate
I have the following error:
[ERROR] Incorrect configuration of jOOQ code generation tool
[ERROR]
The jOOQ-codegen-maven module's generator configuration is not set up correctly.
This can have a variety of reasons, among which:
- Your pom.xml's <configuration> contains invalid XML according to jooq-codegen-3.20.1.xsd
- There is a version or artifact mismatch between your pom.xml and your commandline
But I don't find the error
This is more of a Maven problem than a jOOQ problem, see e.g.
You have to specify the execution ID with your Maven command, e.g. assuming my-id
is the execution ID:
mvn jooq-codegen:generate@my-id
We'll ensure that this information will be documented in the manual, and logged in the error message that you've seen, as it's a common pitfall of Maven execution configurations:
If you don't really need multiple executions, it also works like this (putting the configuration
in the plugin instead of the execution):
<build>
<plugins>
<plugin>
<groupId>org.jooq</groupId>
<artifactId>jooq-codegen-maven</artifactId>
<version>${jooq.version}</version>
<executions>
<execution>
<id>my-id</id>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
...
</configuration>
</plugin>
</plugins>
</build>
Or alternatively, use the "special" default-cli
execution ID:
<build>
<plugins>
<plugin>
<groupId>org.jooq</groupId>
<artifactId>jooq-codegen-maven</artifactId>
<version>${jooq.version}</version>
<executions>
<execution>
<id>default-cli</id>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
...
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Now you can run:
mvn jooq-codegen:generate