【问题标题】:Liquibase maven diff not showing differencesLiquibase maven diff没有显示差异
【发布时间】:2014-09-29 14:45:15
【问题描述】:

我刚刚开始使用 Liquibase,并想使用 maven 插件来显示两个不同数据库之间的差异(我知道这是不同的,因为我在其中一个中创建了一个名为“wallawalla”的随机表)但是Liquibase diff 没有显示任何结果。

这是我的 pom.xml:

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <groupId>com.me</groupId>
        <artifactId>databasechecker</artifactId>
        <version>0.0.1-SNAPSHOT</version>


        <build>
            <plugins>
                <plugin>
                    <groupId>org.liquibase</groupId>
                    <artifactId>liquibase-maven-plugin</artifactId>
                    <version>3.2.2</version>
                    <configuration>
                        <propertyFile>liquibase.properties</propertyFile>
                    </configuration>

                    <dependencies>
                        <dependency>
                            <groupId>org.liquibase.ext</groupId>
                            <artifactId>liquibase-hibernate3</artifactId>
                            <version>3.4</version>
                        </dependency>
                        <dependency>
                            <groupId>org.liquibase</groupId>
                            <artifactId>liquibase-core</artifactId>
                            <version>3.2.2</version>
                        </dependency>
                    </dependencies>
                </plugin>
            </plugins>
        </build>
    </project>

这是我的 liquibase.properties:

    changeLogFile=changelog-master.xml

    url=jdbc:oracle:thin:@xxxxxx.com:1521:ORCL
    driver=oracle.jdbc.driver.OracleDriver
    username=synch_dev
    password=xxxxxx


    referenceUrl=jdbc:mysql://localhost:3306/test
    referenceDriver=com.mysql.jdbc.Driver
    referenceUsername=root
    referencePassword=xxxxxx

然后我运行:

    c:\Dev\eclipseworkspace\databasechecker>mvn liquibase:diff

但它没有显示变化:

    Diff Results:
    Reference Database: root@localhost @ jdbc:mysql://localhost:3306/test (Default Schema: test)
    Comparison Database: SYNCH_DEV @ jdbc:oracle:thin:@xxxxxx:1521:ORCL (Default Schema: SYNCH_DEV)
    Product Name:
         Reference:   'MySQL'
         Target: 'Oracle'
    Product Version:
         Reference:   '5.6.11'
         Target: 'Oracle Database 11g Release 11.2.0.2.0 - 64bit Production'
    Missing Catalog(s): NONE
    Unexpected Catalog(s): NONE
    Changed Catalog(s): NONE
    Missing Column(s): NONE
    Unexpected Column(s): NONE
    Changed Column(s): NONE
    Missing Foreign Key(s): NONE
    Unexpected Foreign Key(s): NONE
    Changed Foreign Key(s): NONE
    Missing Index(s): NONE
    Unexpected Index(s): NONE
    Changed Index(s): NONE
    Missing Primary Key(s): NONE
    Unexpected Primary Key(s): NONE
    Changed Primary Key(s): NONE
    Missing Schema(s): NONE
    Unexpected Schema(s): NONE
    Changed Schema(s): NONE
    Missing Sequence(s): NONE
    Unexpected Sequence(s): NONE
    Changed Sequence(s): NONE
    Missing Stored Procedure(s): NONE
    Unexpected Stored Procedure(s): NONE
    Changed Stored Procedure(s): NONE
    Missing Table(s): NONE
    Unexpected Table(s): NONE
    Changed Table(s): NONE
    Missing Unique Constraint(s): NONE
    Unexpected Unique Constraint(s): NONE
    Changed Unique Constraint(s): NONE
    Missing View(s): NONE
    Unexpected View(s): NONE
    Changed View(s): NONE
    [INFO] ------------------------------------------------------------------------
    [INFO]
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESSFUL
    [INFO] ------------------------------------------------------------------------

有什么想法可以让它显示我的差异吗?

编辑

当我在命令行上直接使用 liquibase.bat 调用 liquibase 时,差异可以正常工作,并将 liquibase.properties 文件中的属性作为参数传递给命令。那么这是maven插件的错误,还是我配置不正确?

【问题讨论】:

  • 我认为您不需要在插件定义中明确引用 liquibase:core 和 liquibase:hibernate3 。我省略了这些,我使用 liquibase-maven-plugin 的 3.1.1 版本。也就是说,我已经广泛使用了 diff 并且确实会在有一些更改时进行更改。最坏的情况你能降级插件版本并测试吗?
  • 如果没有插件中的显式依赖项,它将无法工作,根据这个问题:stackoverflow.com/questions/8214034/… 我将尝试回滚到以前的版本,看看会发生什么

标签: maven-plugin liquibase


【解决方案1】:

这似乎是 Liquibase 3.2.2 (https://liquibase.jira.com/browse/CORE-1987) 的问题,该问题已在即将发布的 3.2.3 版本中修复。

【讨论】:

  • 好地方!他们会发布一些根本上缺乏功能的东西,这似乎很奇怪——我想在他们的构建过程中使用 Maven 插件的 Java 开发人员的数量是巨大的。很高兴看到它在下一个版本中得到修复,Liquibase 很棒:)
猜你喜欢
  • 1970-01-01
  • 2011-06-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-04-27
  • 2020-01-18
  • 2016-03-07
相关资源
最近更新 更多