【问题标题】:Liquibase maven plugin with multiple databases具有多个数据库的 Liquibase maven 插件
【发布时间】:2018-02-15 05:42:23
【问题描述】:

我尝试通过 liquibase maven 插件使用多个数据库。我点击了链接:liquibase using maven with two databases

但是,当我尝试运行它时,我收到一个错误“[ERROR] Failed to execute goal org.liquibase:liquibase-maven-plugin:3.5.3:update (default-cli) on project liquibase-helloworld-demo:尚未将数据库 URL 指定为参数或属性文件。"

请在下面找到我的 pom:

<build>
    <finalName>liquibase-helloworld-demo</finalName>
    <plugins>
        <plugin>
            <groupId>org.liquibase</groupId>
            <artifactId>liquibase-maven-plugin</artifactId>
            <version>3.5.3</version>
            <executions>
                <execution>
                    <id>id1</id>
                    <phase>process-resources</phase>
                    <configuration>
                        <changeLogFile>
                            ${basedir}/src/main/resources/liquibase/changelog1.xml
                        </changeLogFile>
                        <driver>com.mysql.jdbc.Driver</driver>
                        <url>jdbc:mysql://localhost:3306/liquibase-test</url>
                        <username>*****</username>
                        <password>*****</password>
                    </configuration>
                    <goals>
                        <goal>update</goal>
                    </goals>
                </execution>
                <execution>
                    <id>id2</id>
                    <phase>process-resources</phase>
                    <configuration>
                        <changeLogFile>
                            ${basedir}/src/main/resources/liquibase/changelog2.xml
                        </changeLogFile>
                        <driver>com.mysql.jdbc.Driver</driver>
                        <url>jdbc:mysql://localhost:3306/liquibase-test</url>
                        <username>*****</username>
                        <password>*****</password>
                    </configuration>
                    <goals>
                        <goal>update</goal>
                    </goals>
                </execution>
            </executions>
            <dependencies>
                <dependency>
                    <groupId>mysql</groupId>
                    <artifactId>mysql-connector-java</artifactId>
                    <version>5.1.9</version>
                </dependency>
            </dependencies>
        </plugin>
    </plugins>
</build>

你能帮忙吗?提前致谢。

谢谢 拉胡尔·萨拉斯瓦特

【问题讨论】:

    标签: maven-plugin liquibase multiple-databases


    【解决方案1】:

    我们在 Spring Boot 应用程序中使用了 postgres 和 mysql,如下所示。检查它以寻求帮助。

    spring:
        datasource:
            initialize: false
        db1Datasource:
            jdbcUrl: jdbc:postgresql://localhost:5432/db1
            driverClassName: org.postgresql.Driver
            username: postgres
            password: root
            poolName: HikariCP-db1-pool
            liquibase:
                change-log: classpath:database/db1/changelog.groovy
                contexts: dev
        db2Datasource:
            jdbcUrl: jdbc:mysql://localhost:3306/db2
            driverClassName: com.mysql.jdbc.Driver
            username: root
            password: root
            poolName: HikariCP-db2-pool
            liquibase:
                change-log: classpath:database/db2/changelog.groovy
                contexts: dev
    

    【讨论】:

    • 你能提供更多细节吗,比如 pom.xml
    猜你喜欢
    • 2016-07-05
    • 1970-01-01
    • 1970-01-01
    • 2014-10-11
    • 1970-01-01
    • 2019-02-10
    • 2015-08-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多