spring Liquibase maven插件无法在版本4.17.0或更高版本中创建更改日志

lymnna71  于 2023-03-07  发布在  Spring
关注(0)|答案(1)|浏览(136)

我将liquibase从4.16.1升级到4.18.0。当我运行命令时

mvn liquibase:diff -Pdev -Dliquibase.url="jdbc:sqlserver://URL;encrypt=false" -Dliquibase.username="db-admin" -Dliquibase.password="PASSWORD" -Dliquibase.referenceUrl="jdbc:sqlserver://URL;encrypt=false" -Dliquibase.referenceUsername="sa" -Dliquibase.referencePassword="PASSWORD"

我得到了错误

[ERROR] Failed to execute goal org.liquibase:liquibase-maven-plugin:4.18.0:diff (default-cli) on project pres: 
[ERROR] Error setting up or running Liquibase:
[ERROR] liquibase.exception.CommandExecutionException: java.io.IOException: Cannot parse resource location: 'src/main/resources/db/changelog/dev/2022-12-17T01:09:39Z_changelog.xml
    • 聚合物. xml**
<!-- Liquibase plugin-->
            <plugin>
                <groupId>org.liquibase</groupId>
                <artifactId>liquibase-maven-plugin</artifactId>
                <version>${liquibase-maven-plugin.version}</version>
                <configuration>
                    <propertyFile>src/main/resources/liquibase.properties</propertyFile>
                    <outputChangeLogFile>src/main/resources/db/db.changelog-${activeProfile}.xml</outputChangeLogFile>
                    <changeLogFile>src/main/resources/db/db.changelog-${activeProfile}.xml</changeLogFile>
                    <diffChangeLogFile>
                        src/main/resources/db/changelog/${activeProfile}/${maven.build.timestamp}_changelog.xml
                    </diffChangeLogFile>
                    <logging>info</logging>
                </configuration>

                <!-- Liquibase dependencies-->
                <dependencies>
                    <dependency>
                        <groupId>org.liquibase</groupId>
                        <artifactId>liquibase-core</artifactId>
                        <version>${liquibase-core.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.liquibase.ext</groupId>
                        <artifactId>liquibase-hibernate5</artifactId>
                        <version>${liquibase-hibernate5.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.springframework.boot</groupId>
                        <artifactId>spring-boot-starter-data-jpa</artifactId>
                        <version>${spring-boot.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>jakarta.validation</groupId>
                        <artifactId>jakarta.validation-api</artifactId>
                        <version>${validation-api.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.javassist</groupId>
                        <artifactId>javassist</artifactId>
                        <version>${javassist.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>javax.xml.bind</groupId>
                        <artifactId>jaxb-api</artifactId>
                        <version>${jaxb-api.version}</version>
                    </dependency>
                </dependencies>
            </plugin>

在4.16.x或之前liquibase创建更改日志文件,如果不存在,现在它不创建它。

7xllpg7q

7xllpg7q1#

默认情况下,Maven时间戳生成不兼容的文件名:2022年12月17日零时1分9秒39分
要改变这一点,你必须添加到你的pom.xml:

<properties>
        <maven.build.timestamp.format>yyyyMMddHHmmss</maven.build.timestamp.format>
</properties>

相关问题