Khrystyna Makar
Khrystyna Makar

Reputation: 472

jooq-codegen-maven plugin for different db at the same time

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?

Upvotes: 4

Views: 1380

Answers (1)

Lukas Eder
Lukas Eder

Reputation: 220762

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.18.6</version>

  <configuration>
    <!-- Optional, shared configuration -->
  </configuration>

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

Upvotes: 8

Related Questions