【发布时间】:2022-01-23 16:25:39
【问题描述】:
我想将 flyway 与 testcontainers 一起用于 jooq 生成。为此,我有 2 个插件
<plugin>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-maven-plugin</artifactId>
<version>7.14.0</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>migrate</goal>
</goals>
</execution>
</executions>
<configuration>
<url>jdbc:tc:postgresql:10://localhost:7432/test</url>
<user>test</user>
<password>test</password>
<driver>
org.testcontainers.jdbc.ContainerDatabaseDriver
</driver>
<locations>
<location>filesystem:src/main/resources/db/migrations</location>
</locations>
</configuration>
</plugin>
<plugin>
<groupId>org.jooq</groupId>
<artifactId>jooq-codegen-maven</artifactId>
<version>3.14.15</version>
<executions>
<execution>
<id>java-generator</id>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<jdbc>
<driver>org.testcontainers.jdbc.ContainerDatabaseDriver</driver>
<url>jdbc:tc:postgresql:10://localhost:7432/test</url>
<user>test</user>
<password>test</password>
</jdbc>
<generator>
<database>
<name>org.jooq.meta.postgres.PostgresDatabase</name>
<includes>.*</includes>
<inputSchema>public</inputSchema>
</database>
<generate/>
<target>
<packageName>com.test</packageName>
<directory>target/generated-sources/jooq</directory>
</target>
</generator>
</configuration>
</plugin>
所以,我看到 flyway 启动了 tc,应用了所有脚本,然后 jooq 启动了自己的容器并尝试生成实体,但什么也没有。你能建议如何处理这个问题吗?
【问题讨论】:
标签: java code-generation jooq flyway testcontainers