【发布时间】: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/… 我将尝试回滚到以前的版本,看看会发生什么