1

我已经在 J​​enkins 中安装了 Liquibase runner 1.3.0 插件,并尝试执行我在执行“diffChangeLog”命令后得到的 liquibase 更改日志脚本文件。在执行脚本文件时,我收到Failed to read schema document ' http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd '作为异常。我检查了我的变更日志文件,它有下面提到的标题。

<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
    xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
    xmlns:pro="http://www.liquibase.org/xml/ns/pro"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext
                        http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd
                        http://www.liquibase.org/xml/ns/pro
                        http://www.liquibase.org/xml/ns/pro/liquibase-pro-3.8.xsd
                        http://www.liquibase.org/xml/ns/dbchangelog
                        http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd">

但是现在在这里,当我在标题中的两个位置将“3.8”替换为“3.5”时,它就会成功执行。我希望仅使用“3.8”执行此操作。请帮忙。

4

3 回答 3

4

更改日志中的标头仅指定将更改日志 xml 文件解析为对象时使用的 xsd(XML 模式描述)。该 xsd 嵌入在命令运行时正在使用的 liquibase jar 文件中。您面临的问题是 Jenkins v 1.3.0 的 Liquibase Runner 插件中嵌入了旧版本的 liquibase jar。如果您查看该插件的更改历史记录,您会发现它包含 3.5.3 版 Liquibase,因此您只能使用该版本中可用的 XML 标记。您可以将 xsd 设置为参考版本 3.5。

Liquibase 的人员(包括我自己)目前正在为 Jenkins 发布更新版本的 Liquibase 运行器插件,其中包含更新版本的 Liquibase。我正在与原作者合作解决 Jenkins 团队标记的安全问题。我没有具体的日期。如果您需要它,您可以自己构建插件,在构建它之前将 PR#16 应用到您的本地副本。该插件的源代码位于https://github.com/jenkinsci/liquibase-runner-plugin

如果您想了解有关 Liquibase XML 和 xsd 的更多信息,我在 Liquibase 常见问题解答中编写了一个部分来涵盖该主题

于 2020-03-13T14:41:11.763 回答
0

我在运行 Spring Boot 项目时看到了这个错误,但 SteveDonie 的回答仍然让我找到了我的解决方案。错误的原因是更改日志文件是使用比正在运行的更新版本的 Liquibase 创建的。对我来说,我必须在我的 maven pom 中更新 liquibase 版本。

于 2020-05-15T00:36:17.470 回答
0

也许我可以帮助别人!:)

  1. 检查 resources/db/changelog/* 中的所有文件!如果您在一个文件中进行更改 -> 您必须在任何地方进行!我认为它必须是相似的;
  2. 查看https://docs.liquibase.com/concepts/basic/xml-format.html官方文档 liquibase,它最适合您,因为官方文档中的信息是真实的。

PS对不起我的英语:)

于 2021-09-19T20:09:38.350 回答