繁体   English   中英

Liquibase,本地 XSD 参考

[英]Liquibase, local XSD reference

我正在使用带有以下符号的 liquibase xml 配置文件(spring 集成)

<databaseChangeLog 
      xmlns="http://www.liquibase.org/xml/ns/dbchangelog" 
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
      xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog  
      http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">

所以..我会使用我的应用程序离线模式,并将“类路径”符号放入我的更改日志中:

<databaseChangeLog 
      xmlns="http://www.liquibase.org/xml/ns/dbchangelog" 
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
      xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog  
      classpath:xsd/dbchangelog-3.1.xsd">

但我有跟随错误。 你能帮助我吗?

Caused by: java.net.MalformedURLException: unknown protocol: classpath
        at java.net.URL.<init>(URL.java:592)
        at java.net.URL.<init>(URL.java:482)
        at java.net.URL.<init>(URL.java:431)
        at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:610)
        at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:189)
        at com.sun.org.apache.xerces.internal.impl.xs.opti.SchemaParsingConfig.parse(SchemaParsingConfig.java:582)
        at com.sun.org.apache.xerces.internal.impl.xs.opti.SchemaParsingConfig.parse(SchemaParsingConfig.java:685)
        at com.sun.org.apache.xerces.internal.impl.xs.opti.SchemaDOMParser.parse(SchemaDOMParser.java:530)
        at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.getSchemaDocument(XSDHandler.java:2175)

我通过在项目中本地添加相关的 XSD 文件dbchangelog-3.5.xsd并更新 Liquibase 配置文件( xsi:schemaLocation部分)来解决这个问题,如下所示:

<databaseChangeLog
        xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog dbchangelog-3.5.xsd">

所以现在 XSD 文件位置配置为dbchangelog-3.5.xsd 只需确保 XSD 文件与 Liquibase 配置文件位于同一目录中。

暂无
暂无

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

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