同时为不同的数据库添加jooq-codegen-maven插件 [英] jooq-codegen-maven plugin for different db at the same time

查看:862
本文介绍了同时为不同的数据库添加jooq-codegen-maven插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用程序中使用jOOQ和MySQL DB。对于集成测试,我使用H2数据库,存在问题。有两种方法可以运行jooq-codegen-maven插件吗?我为此案例找到了一些 maven示例。但是,在两种不同的情况下,我必须使用两种不同的依赖项。我可以以某种方式在执行中包含依赖吗?

I use jOOQ and MySQL DB in my application. For integration tests I use H2 database and there is a problem. Is there some way to run jooq-codegen-maven plugin twice? I found some maven example for this case. However, in two different cases, I must use two different dependencies. Can I somehow to include dependency in execution?

推荐答案

您可以有多个< execution> 元素,例如

You can have multiple <execution> elements in any Maven plugin configuration, e.g.

<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>

这篇关于同时为不同的数据库添加jooq-codegen-maven插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆