繁体   English   中英

必须在 Liquibase 上指定 changeLogFile 错误

[英]The changeLogFile must be specified error on Liquibase

我是 Liquibase 的新手,我尝试将 liquibase 与 postgres 数据库结合使用,以使用 liquibase 脚本创建数据库表。 我所做的是,我已经通过运行命令手动创建了 Postgres 表

mvn liquibase:generateChangeLog

我创建了 liquibase-outputChangeLog.xml 文件。 现在我尝试更新该脚本并在数据库中再创建一个表。 为此,我在我的 changeLog.xml 文件中为该新表编写了 XML 代码,并尝试执行命令

mvn liquibase:更新

但它给我以下错误

必须指定 ChangeLogFile。

下面是我的 POM.xml 文件。

    <dependency>
        <groupId>tech.sample</groupId>
        <artifactId>common-starter-test</artifactId>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>tech.sample</groupId>
        <artifactId>common-starter-logging</artifactId>
    </dependency>

    <dependency>
        <groupId>org.liquibase</groupId>
        <artifactId>liquibase-core</artifactId>
        <version>3.8.7</version>
    </dependency>

    <dependency>
        <groupId>org.liquibase</groupId>
        <artifactId>liquibase-maven-plugin</artifactId>
        <version>3.8.7</version>
    </dependency>

    <dependency>
        <groupId>org.postgresql</groupId>
        <artifactId>postgresql</artifactId>
        <version>42.2.5</version>
    </dependency>

</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
        </plugin>
        <!--Sonar Plugins-->
        <plugin>
            <groupId>org.sonarsource.scanner.maven</groupId>
            <artifactId>sonar-maven-plugin</artifactId>
        </plugin>
        <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
        </plugin>
        <plugin>
            <groupId>com.github.temyers</groupId>
            <artifactId>cucumber-jvm-parallel-plugin</artifactId>
        </plugin>

        <plugin>
            <groupId>org.liquibase</groupId>
            <artifactId>liquibase-maven-plugin</artifactId>
            <version>3.4.1</version>
            <configuration>
                <propertyFile>src/main/resources/liquibase.properties</propertyFile>
            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>update</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

他们中的任何一个都可以帮助我,这里有什么问题。

强文本**在这里输入图片描述**

我认为问题在于,在您的 pom.xml <propertyFile>src/main/resources/liquibase.properties</propertyFile>中指定的属性文件中,您使用了ChangeLogFile (大写 C)而不是changeLogFile (低案例 C)。 请注意,错误消息显示正确的大小写。

对于数据库更新,您必须在插件liquibase-maven-plugin部分的pom.xml中指定属性changeLogFile 见片段:

        <plugin>
            <groupId>org.liquibase</groupId>
            <artifactId>liquibase-maven-plugin</artifactId>
            <version>${liquibase.version}</version>
            <configuration>                  
                <propertyFile>src/main/resources/db/liquibase.properties</propertyFile>
                <changeLogFile>src/main/resources/db/updateDb.xml</changeLogFile>
            </configuration>
        </plugin> 

在 liquibase 4.7.1上运行

这里是完整的 MVN 日志:

    bmolino@Betelgeuse:~/git/simbo-repo/simbo/simbo-ws(master)$ /opt/apache-maven-3.6.3/bin/mvn liquibase:update
    [INFO] Scanning for projects...
    [INFO] 
    [INFO] ----------------< it.invallee.webapp.simbo-ws:simbo-ws >----------------
    [INFO] Building simbo-ws 0.0.1-SNAPSHOT
    [INFO] --------------------------------[ jar ]---------------------------------
    [INFO] 
    [INFO] --- liquibase-maven-plugin:4.7.1:update (default-cli) @ simbo-ws ---
    [INFO] ------------------------------------------------------------------------
    [project, pluginDescriptor]
    [INFO] Parsing Liquibase Properties File
    [INFO]   File: src/main/resources/db/liquibase.properties
    [INFO]   'outputChangeLogFile' in properties file is not being used by this task.
    [INFO] ------------------------------------------------------------------------
    [INFO] 
    [INFO] 
    [INFO] Liquibase Community 4.7.1 by Liquibase
    [INFO] ####################################################
    ##   _     _             _ _                      ##
    ##  | |   (_)           (_) |                     ##
    ##  | |    _  __ _ _   _ _| |__   __ _ ___  ___   ##
    ##  | |   | |/ _` | | | | | '_ \ / _` / __|/ _ \  ##
    ##  | |___| | (_| | |_| | | |_) | (_| \__ \  __/  ##
    ##  \_____/_|\__, |\__,_|_|_.__/ \__,_|___/\___|  ##
    ##              | |                               ##
    ##              |_|                               ##
    ##                                                ## 
    ##  Get documentation at docs.liquibase.com       ##
    ##  Get certified courses at learn.liquibase.com  ## 
    ##  Free schema change activity reports at        ##
    ##      https://hub.liquibase.com                 ##
    ##                                                ##
    ####################################################
    Starting Liquibase at 16:05:17 (version 4.7.1 #1239 built at 2022-01-20 20:31+0000)
    [INFO] Set default schema name to public
    [INFO] Parsing Liquibase Properties File src/main/resources/db/liquibase.properties for changeLog parameters
    [INFO] Executing on Database: jdbc:postgresql://XX.XXX.XXX.XXX:5432/simbo
    [INFO] Successfully acquired change log lock
    [INFO] Reading from databasechangelog
    Running Changeset: src/main/resources/db/updateDb.xml::1::bob
    [INFO] Table department created
    [INFO] ChangeSet src/main/resources/db/updateDb.xml::1::bob ran successfully in 16ms
    [INFO] Successfully released change log lock
    [INFO] ------------------------------------------------------------------------
    [INFO] 
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time:  2.073 s
    [INFO] Finished at: 2022-01-28T16:05:18+01:00
    [INFO] ------------------------------------------------------------------------

您应该移至liquibase版本4.11.0

并将changeLogFile更改为outputChangeLogFile

希望有帮助

当您在liquibase.properties中更改某些内容时,您应该每次都编译源代码。 mvn compile

暂无
暂无

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

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