如何配置jooq-codegen-maven,使我只能手动运行,而不是在每次编译时运行。

问题描述 投票:0回答:1

目前我的jooq-codegen-maven插件在每次编译时都会运行,导致编译速度变慢。我只想在改变DB模式后手动运行它。我如何改变插件配置来实现这个目标?

      <plugin>
            <groupId>org.jooq</groupId>
            <artifactId>jooq-codegen-maven</artifactId>
            <version>${jooq.version}</version>

            <executions>
                <execution>
                    <phase>generate-sources</phase>
                    <goals>
                        <goal>generate</goal>
                    </goals>
                </execution>
            </executions>

            <configuration>
                <jdbc>
                    <url>${jooq.db.url}</url>
                    <user>${jooq.db.username}</user>
                    <password>${jooq.db.username}</password>
                </jdbc>
                <generator>
                    <database>
                        <includes>.*</includes>
                        <inputSchema>${jooq.db.schema}</inputSchema>
                    </database>
                    <target>
                        <packageName>my.package.name.generated.jooq</packageName>
                        <directory>${project.build.directory}/generated-sources/jooq</directory>
                    </target>
                </generator>
            </configuration>
        </plugin>
maven jooq jooq-codegen-maven
1个回答
1
投票

简单的删除执行。

<executions>
    <execution>
       <phase>generate-sources</phase>
       <goals>
          <goal>generate</goal>
       </goals>
    </execution>
 </executions>

因为这个配置会在Maven的生成资源阶段运行jooq codegen插件。


1
投票

你可以使用配置文件。

<profiles>
  <profile>
    <id>generate-jooq-code</id>
    <plugins>
      <plugin>
        <groupId>org.jooq</groupId>
        <artifactId>jooq-codegen-maven</artifactId>
        ...
      </plugin>
    </plugins>
  </profile>
</profiles>

然后..:

mvn generate-sources -P generate-jooq-code
© www.soinside.com 2019 - 2024. All rights reserved.