0

How to configure Liquibase plugin with Maven project for the two DB (MySQL, PostgreSQL)?

I configured liquibase only MySQL DB. Also need for PostgreSQL DB.

Properties for PostgreSQL DB:

driverClassName = org.postgresql.Driver
url = jdbc:postgresql://localhost:5432/postgresql_db
username = postgres
password = root
  • pom.xml:

    <build><plugins>
        <plugin>
            <groupId>org.liquibase</groupId>
            <artifactId>liquibase-maven-plugin</artifactId>
            <version>3.4.1</version>
            <configuration>
                <changeLogFile>src/main/resources/dbliquibase/dbchangelog.xml</changeLogFile>
                <driver>com.mysql.jdbc.Driver</driver>
                <url>jdbc:mysql://localhost:3306/mysql_db</url>
                <username>root</username>
                <password>root</password>
                <promptOnNonLocalDatabase>false</promptOnNonLocalDatabase>
            </configuration>
        </plugin>
    </plugins></build>
    
Giovanni
  • 37
  • 4
  • have you tried defining 2 [`executions`](https://maven.apache.org/guides/mini/guide-configuring-plugins.html#Using_the_executions_Tag) and configuring one for each of the databases? – DB5 Oct 10 '15 at 20:16

1 Answers1

0

the plugin you can declare as many times as it is linked to an implementation phase, you also have the possibility to use a plugin that launches a dynamic ways and multiple times a plugin iteration iterator-maven-plugin :

http://khmarbaise.github.io/iterator-maven-plugin/

Personally I do not recommend these solutions , I in your place, I created two profiles and I run either :

liquibase using maven with two databases does not work

Want to two different databases with a single run contrary to the fundamental principle of separation of responsibility in Java

Community
  • 1
  • 1
question_maven_com
  • 2,457
  • 16
  • 21