简体   繁体   English

Liquibase maven 多模块

[英]Liquibase maven multimodule

I'm trying to get liquibase to generate changesets based on Hibernate entities.我正在尝试让 liquibase 生成基于 Hibernate 实体的变更集。 We have a multi-module maven project, with persisted objects sprinkled around the different modules.我们有一个多模块 maven 项目,持久对象散布在不同的模块周围。 When I run mvn liquibase:generateChangeLog, it executes for every module, repeating same output over and over in the generated changelog file当我运行 mvn liquibase:generateChangeLog 时,它会为每个模块执行,在生成的更改日志文件中一遍又一遍地重复相同的 output

my advise is to managed db schema out of your exiting maven modules, in a separate one:我的建议是从现有的 maven 模块中单独管理数据库模式:

  1. if these modules are linked to the same database, you have no choice ti have a unique schema, and a unique liquibase management如果这些模块链接到同一个数据库,那么您别无选择,因为它们拥有独特的架构和独特的 liquibase 管理
  2. if these modules use different schema, you can have different liquibase changelog.如果这些模块使用不同的架构,您可以有不同的 liquibase 更改日志。 The generation will be different because of different schema由于架构不同,生成会有所不同

Eric埃里克

Figured out the solution to this: so we have a bunch of core maven modules and a set of modules with customizations for specific customers.想出了解决方案:所以我们有一堆核心 maven 模块和一组为特定客户定制的模块。 Ultimately the customer modules are "top level" modules, and when application is packaged, it's packaged for the specific top-level customer module.最终,客户模块是“顶级”模块,并且在打包应用程序时,它会针对特定的顶级客户模块进行打包。

So solution was to add the following to all but the "top level" customer modules因此,解决方案是将以下内容添加到“顶级”客户模块之外的所有模块中

<build>
    <plugins>
        <plugin>
            <groupId>org.liquibase</groupId>
            <artifactId>liquibase-maven-plugin</artifactId>
            <version>3.9.0</version>
            <configuration>
                <skip>true</skip>
            </configuration>
        </plugin>
    </plugins>
</build>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM