spring 必须在Liquibase上指定changeLogFile错误

xmq68pz9  于 2022-12-28  发布在  Spring
关注(0)|答案(4)|浏览(186)

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

  • mvn liquibase:生成更改日志 *

我创建了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>

他们中有谁能帮帮我吗?出什么事了?
强文本x1c 0d1x

vtwuwzda

vtwuwzda1#

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

oknrviil

oknrviil2#

您应该迁移到liquibase版本4.11.0
并将changeLogFile更改为outputChangeLogFile
希望能帮上忙

64jmpszr

64jmpszr3#

对于数据库更新,您必须在 pom.xml 的plugin liquibase-maven-plugin 部分中指定属性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>

在液体基质上运行 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**] **------------------------------------------------------------------------**
m2xkgtsf

m2xkgtsf4#

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

相关问题