0

如何配置我的 Maven 以从不同的数据库生成代码?我有这个配置:

<plugin>
    <groupId>org.jooq</groupId>
    <artifactId>jooq-codegen-maven</artifactId>
    <version>3.16.1</version>
    <dependencies>
        <dependency>
            ...postgres dependency...
        </dependency>
    </dependencies>
    <executions>
        <execution>
            ...id-name...
            ...phase...
            ...goals...
            <configuration>
                <jdbc> 
                    <driver>org.postgresql.Driver</driver>
                    <url>'url'</url>
                    <user>'user'</user>
                    <password>'pswd'</password>
                </jdbc>
                <generator>
                    <database>
                       ...includes...
                       ...excludes...
                       ...inputSchema...
                    </database>
                    <generate>
                        <records>true</records>
                    </generate>
                    <target>
                        <packageName>com.example.testtask</packageName>
                        <directory>target/generated-sources/jooq</directory>
                    </target>
                </generator>
            </configuration>
        </execution>
        <execution>
            ...id-second-name...
             ...phase...
            ...goals...
            <configuration>
                <jdbc>  
                    <driver>org.postgresql.Driver</driver>
                    <url>'second-url'</url>
                    <user>'user'</user>
                    <password>'pswd'</password>
                </jdbc>
                <generator>
                    <database>
                       ...includes...
                       ...excludes...
                       ...inputSchema...
                    </database>
                    <generate>
                        ...
                    </generate>
                    <target>
                       ...
                    </target>
                </generator>
            </configuration>
        </execution>
    </executions>
</plugin> 

如何正确配置?
它适用于一次执行,但是当我添加第二次时,构建失败。

4

0 回答 0