首页 > 解决方案 > Liquibase 使用 maven 生成具有多个模式的 generateChangeLog

问题描述

在我的项目中,我们希望使用 liquibase 为我们正在使用的多个模式生成 sql。我已经用单个模式配置了 maven 插件,它工作正常,但是当我尝试配置具有执行的多个模式时,它不起作用。我通过创建不同的配置文件和该配置文件的特定目标来尝试它,它可以工作文件,但我希望它在单个目标中运行,所有模式具有特定于每个模式的不同更改日志。

下面是我用于单一模式的配置

<plugin>
                <groupId>org.liquibase</groupId>
                <artifactId>liquibase-maven-plugin</artifactId>
                <version>3.4.1</version>
                <configuration>
                    <propertyFile>${project.build.directory}/unpack/liquibase.properties</propertyFile>
                    <outputChangeLogFile>${project.build.directory}/liquibase-outputChangeLog.xml</outputChangeLogFile>
                    <changeLogFile>${project.build.directory}/liquibase-outputChangeLog.xml</changeLogFile>
                    <diffTypes>tables, views, columns, indexes, foreignkeys, primarykeys, uniqueconstraints, data</diffTypes>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.liquibase.ext</groupId>
                        <artifactId>liquibase-hibernate4</artifactId>
                        <version>3.5</version>
                    </dependency>
                    <!-- ojdbc6.jar example -->
                    <dependency>
                        <groupId>com.oracle</groupId>
                        <artifactId>ojdbc6</artifactId>
                        <version>11.2.0.1</version>
                    </dependency>

                    <!-- ojdbc7.jar example -->
                    <dependency>
                        <groupId>com.oracle</groupId>
                        <artifactId>ojdbc7</artifactId>
                        <version>12.1.0.2</version>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <id>generate-change-log</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>generateChangeLog</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>sync-sql-log</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>changelogSync</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>generate-sql-log</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>updateSQL</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

标签: liquibase

解决方案


推荐阅读