简体   繁体   English

如何从我的类路径运行 Liquibase changeLogFile

[英]How do I run a Liquibase changeLogFile from my classpath

I have a Spring Boot application that is configured to run Liquibase.我有一个配置为运行 Liquibase 的 Spring Boot 应用程序。 I'm trying to set up a separate project that will be used as the database management project.我正在尝试建立一个单独的项目,该项目将用作数据库管理项目。 It will store all of liquibase.properties files for different databases.它将存储不同数据库的所有liquibase.properties文件。

My database management project depends on my main app because it needs to load the chaneglogFile.我的数据库管理项目依赖于我的主应用程序,因为它需要加载 chaneglogFile。 However, my database management project cannot find the changelogFile on the classpath.但是,我的数据库管理项目在类路径上找不到 changelogFile。

Here is the folder structure of the main project.这是主项目的文件夹结构。 The changelog is in src/main/resources so maven automatically adds it to the classpath更改日志位于src/main/resources因此 maven 会自动将其添加到类路径中

在此处输入图片说明

Here is the configuration in the liquibase.properties这是liquibase.properties的配置

changeLogFile=classpath:db/changelog/db.changelog-master.yaml

As well as the maven plugin configuration以及maven插件配置

    <build>
        <plugins>
            <plugin>
                <groupId>org.liquibase</groupId>
                <artifactId>liquibase-maven-plugin</artifactId>
                <version>3.8.2</version>
                <configuration>
                    <propertyFile>liquibase.properties</propertyFile>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>com.my-group</groupId>
                        <artifactId>my-app</artifactId>
                        <version>1.0.0-SNAPSHOT</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>

And the resulting error以及由此产生的错误

Failed to execute goal org.liquibase:liquibase-maven-plugin:3.8.2:status (default-cli) on project my-app-db: Error setting up or running Liquibase: classpath:db/changelog/db.changelog-master.yaml does not exist

what about trying尝试怎么样

changeLogFile=src/main/resources/db/changelog/db.changelog-master.yaml

does that work for you?那对你有用吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM