【发布时间】:2014-11-24 01:35:11
【问题描述】:
我在我的应用程序中使用 jOOQ 和 MySQL DB。对于集成测试,我使用 H2 数据库并且存在问题。有没有办法两次运行 jooq-codegen-maven 插件?我为这种情况找到了一些maven example。但是,在两种不同的情况下,我必须使用两种不同的依赖项。我可以以某种方式在执行中包含依赖关系吗?
【问题讨论】:
我在我的应用程序中使用 jOOQ 和 MySQL DB。对于集成测试,我使用 H2 数据库并且存在问题。有没有办法两次运行 jooq-codegen-maven 插件?我为这种情况找到了一些maven example。但是,在两种不同的情况下,我必须使用两种不同的依赖项。我可以以某种方式在执行中包含依赖关系吗?
【问题讨论】:
您可以在任何 Maven 插件配置中拥有多个 <execution> 元素,例如
<plugin>
<groupId>org.jooq</groupId>
<artifactId>jooq-codegen-maven</artifactId>
<version>3.9.1</version>
<executions>
<execution>
<id>first-generation</id>
<phase>generate-sources</phase>
<goals><goal>generate</goal></goals>
<configuration>
<!-- jOOQ configuration here -->
</configuration>
</execution>
<execution>
<id>second-generation</id>
<phase>generate-sources</phase>
<goals><goal>generate</goal></goals>
<configuration>
<!-- jOOQ configuration here -->
</configuration>
</execution>
</executions>
</plugin>
【讨论】:
<execution> 使用mysql <dependency>,其次使用h2database <dependency>。有我的问题
<plugin>...<dependencies><dependency>1</dependency> <dependency>2</dependency> </dependencies>...</plugin>