我使用 liquibase 和 jooq,我需要直接从 liquibase xml 文件生成我的 pojo,但是我在用 Postgres 覆盖默认的“H2”方言时遇到了问题。实际上,我尝试通过插件“配置”部分中的属性设置方言,但它仍然使用 H2。有人可以问我如何让jooq在读取xml文件和生成java类时使用postgres方言。
这是使用的库版本
<properties>
<jooq.version>3.13.4</jooq.version>
<vertx-jooq.version>5.1.1</vertx-jooq.version>
<postgres.version>42.2.12</postgres.version>
</properties>
这是我的插件配置
<plugin>
<groupId>org.jooq</groupId>
<artifactId>jooq-codegen-maven</artifactId>
<version>${jooq.version}</version>
<executions>
<execution>
<id>jooq-generate</id>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>${postgres.version}</version>
</dependency>
<dependency>
<groupId>io.github.jklingsporn</groupId>
<artifactId>vertx-jooq-generate</artifactId>
<version>${vertx-jooq.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<version>3.3.9</version>
</dependency>
<dependency>
<groupId>org.jooq</groupId>
<artifactId>jooq-meta-extensions</artifactId>
<version>${jooq.version}</version>
</dependency>
</dependencies>
<configuration>
<generator>
<name>io.github.jklingsporn.vertx.jooq.generate.classic.ClassicReactiveVertxGenerator</name>
<database>
<name>org.jooq.meta.extensions.liquibase.LiquibaseDatabase</name>
<properties>
<property>
<key>scripts</key>
<value>src/main/resources/liquibase/tenant/changelog.xml</value>
</property>
<property>
<key>changeLogParameters.contexts</key>
<value>!test</value>
</property>
<-- unfortunately this property doesn't work -->
<property>
<key>dialect</key>
<value>POSTGRES</value>
</property>
</properties>
<outputSchemaToDefault>true</outputSchemaToDefault>
<unsignedTypes>false</unsignedTypes>
<forcedTypes />
</database>
<generate>
<daos>true</daos>
<fluentSetters>true</fluentSetters>
</generate>
<target>
<packageName>org.folio.rest.jooq</packageName>
</target>
<strategy>
<name>io.github.jklingsporn.vertx.jooq.generate.VertxGeneratorStrategy</name>
</strategy>
</generator>
</configuration>
</plugin>