【问题标题】:How to configure jooq-codegen-maven, so i can run only manually and not on each compile如何配置jooq-codegen-maven,所以我只能手动运行而不是每次编译
【发布时间】:2020-09-10 03:42:17
【问题描述】:

目前我的 jooq-codegen-maven 插件在每次编译时都会运行,从而减慢了构建速度。在我更改数据库架构后,我只想手动运行它。如何更改插件配置以实现此目的?

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

    只需删除执行:

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

    因为这个配置在 Maven 的 generate-sources 阶段运行了 jooq codegen 插件。

    【讨论】:

      【解决方案2】:

      您可以使用配置文件:

      <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
      

      【讨论】:

        猜你喜欢
        • 2018-03-03
        • 1970-01-01
        • 1970-01-01
        • 2012-12-08
        • 1970-01-01
        • 1970-01-01
        • 2017-07-04
        • 2021-07-30
        • 2016-10-28
        相关资源
        最近更新 更多