This post describes how to upgrade two databases from maven using Liquibase: Liquibase using maven with two databases However, when I try to do the same configuration in my pom.xml (see below), this will not work. I get this error when running 'mvn liquidibase: update':
The driver has not been specified either as a parameter or in a properties file.
Startup with verbose value in true I get:
[INFO] Settings---------------------------- [INFO] driver: null [INFO] url: null [INFO] username: null [INFO] password: null
it seems that the configuration is not transmitted by lipibase. If part of the configuration goes beyond execution, it works, but it defeats the whole idea of having multiple executions - you would like to use different configurations for different executions.
<plugin> <groupId>org.liquibase</groupId> <artifactId>liquibase-plugin</artifactId> <version>1.9.5.0</version> <executions> <execution> <phase>process-resources</phase> <id>one</id> <goals> <goal>update</goal> </goals> <configuration> <changeLogFile>src/main/resources/liquibase/changelog-master.xml</changeLogFile> <driver>com.mysql.jdbc.Driver</driver> <url>jdbc:mysql://127.0.0.1:3306/${database.development}</url> <username>wifi_offload_app</username> <password /> <dropFirst>${liquibase.dropFirst}</dropFirst> </configuration> </execution> <execution> <phase>process-resources</phase> <id>two</id> <goals> <goal>update</goal> </goals> <configuration> <changeLogFile>src/main/resources/liquibase/changelog-master-sbr.xml</changeLogFile> <driver>com.mysql.jdbc.Driver</driver> <url>jdbc:mysql://127.0.0.1:3307/${database.development.sbr}</url> <username>wifi_offload_app</username> <password /> <dropFirst>${liquibase.dropFirst}</dropFirst> </configuration> </execution> </executions> <dependencies> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.12</version> </dependency> </dependencies> </plugin>
Thanks Hari
Update after trying "mvn process-resources" from Mark comment. Here the output from mvn updates both databases.
[ hariharan@msg9 ]$ mvn process-resources [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] Building Offload Manager Service [INFO] task-segment: [process-resources] [INFO] ------------------------------------------------------------------------ [INFO] [resources:resources {execution: default-resources}] [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, ie build is platform dependent! [INFO] Copying 12 resources [INFO] [liquibase:update {execution: one}] [INFO] ------------------------------------------------------------------------ [INFO] Executing on Database: jdbc:mysql://127.0.0.1:3306/db1 Mar 7, 2012 4:11:47 PM liquibase.database.template.JdbcTemplate comment INFO: Create Database Lock Table Mar 7, 2012 4:11:47 PM liquibase.database.template.JdbcTemplate comment INFO: Lock Database Mar 7, 2012 4:11:47 PM liquibase.lock.LockHandler acquireLock INFO: Successfully acquired change log lock Mar 7, 2012 4:11:47 PM liquibase.database.template.JdbcTemplate comment INFO: Create Database Change Log Table Mar 7, 2012 4:11:47 PM liquibase.database.AbstractDatabase checkDatabaseChangeLogTable INFO: Creating database history table with name: `DATABASECHANGELOG` Mar 7, 2012 4:11:48 PM liquibase.database.AbstractDatabase getRanChangeSetList INFO: Reading from `DATABASECHANGELOG` Mar 7, 2012 4:11:48 PM liquibase.database.template.JdbcTemplate comment INFO: Changeset liquibase/changelogs/1328053095_tables.xml::1328053095-1::hariharan::(MD5Sum: bf33ef8ba7352e8c0864e9457ee642b) Mar 7, 2012 4:11:49 PM liquibase.database.template.JdbcTemplate comment INFO: Changeset liquibase/changelogs/1328053095_tables.xml::1328053095-2::hariharan::(MD5Sum: 7cc4f84be549dbcea3589d85df3e059) Mar 7, 2012 4:11:50 PM liquibase.database.template.JdbcTemplate comment INFO: Changeset liquibase/changelogs/1328053095_tables.xml::1328053095-3::hariharan::(MD5Sum: 59821447f5744410a1c36bccd16196f6) Mar 7, 2012 4:11:50 PM liquibase.database.template.JdbcTemplate comment INFO: Release Database Lock Mar 7, 2012 4:11:50 PM liquibase.lock.LockHandler releaseLock INFO: Successfully released change log lock Mar 7, 2012 4:11:50 PM liquibase.database.template.JdbcTemplate comment INFO: Release Database Lock Mar 7, 2012 4:11:50 PM liquibase.lock.LockHandler releaseLock INFO: Successfully released change log lock [INFO] ------------------------------------------------------------------------ [INFO] [INFO] [liquibase:update {execution: two}] [INFO] ------------------------------------------------------------------------ [INFO] Executing on Database: jdbc:mysql://127.0.0.1:3307/db2 Mar 7, 2012 4:11:50 PM liquibase.database.template.JdbcTemplate comment INFO: Create Database Lock Table Mar 7, 2012 4:11:50 PM liquibase.database.template.JdbcTemplate comment INFO: Lock Database Mar 7, 2012 4:11:50 PM liquibase.lock.LockHandler acquireLock INFO: Successfully acquired change log lock Mar 7, 2012 4:11:50 PM liquibase.database.template.JdbcTemplate comment INFO: Create Database Change Log Table Mar 7, 2012 4:11:50 PM liquibase.database.AbstractDatabase checkDatabaseChangeLogTable INFO: Creating database history table with name: `DATABASECHANGELOG` Mar 7, 2012 4:11:50 PM liquibase.database.AbstractDatabase getRanChangeSetList INFO: Reading from `DATABASECHANGELOG` Mar 7, 2012 4:11:50 PM liquibase.database.template.JdbcTemplate comment INFO: Changeset liquibase/changelogs-sbr/1330991147_tables.xml::1330991147-1::hariharan::(MD5Sum: 8cf69599bcf338b57d7fe1ecc1471d86) Mar 7, 2012 4:11:50 PM liquibase.database.template.JdbcTemplate comment INFO: Changeset liquibase/changelogs-sbr/1330991147_tables.xml::1330991147-2::hariharan::(MD5Sum: cf9a9717987fda5deba07a7a943673e1) Mar 7, 2012 4:11:50 PM liquibase.database.template.JdbcTemplate comment INFO: Release Database Lock Mar 7, 2012 4:11:50 PM liquibase.lock.LockHandler releaseLock INFO: Successfully released change log lock Mar 7, 2012 4:11:50 PM liquibase.database.template.JdbcTemplate comment INFO: Release Database Lock Mar 7, 2012 4:11:50 PM liquibase.lock.LockHandler releaseLock INFO: Successfully released change log lock [INFO] ------------------------------------------------------------------------ [INFO] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESSFUL [INFO] ------------------------------------------------------------------------ [INFO] Total time: 6 seconds [INFO] Finished at: Wed Mar 07 16:11:50 PST 2012 [INFO] Final Memory: 23M/180M [INFO] ------------------------------------------------------------------------