当前位置: 首页 > 知识库问答 >
问题:

Maven构建失败Liquibase: cvc-elt.1元素声明找不到

林博厚
2023-03-14

我对Liquibase完全陌生,我设置了一个相当简单的项目来熟悉Liquibase。不幸的是,我似乎在第一步就失败了,这非常令人沮丧。

首先是我的变更日志。xml:

<?xml version="1.0" encoding="UTF-8"?>

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

    <preConditions>
        <dbms type="mysql"/>
    </preConditions>

    <changeSet id="1" author="maik">
        <sql dbms="mysql" endDelimiter=";">
            CREATE SCHEMA ods
        </sql>
        <createTable tableName="department">
            <column name="id" type="int">
                <constraints primaryKey="true" nullable="false"/>
            </column>
            <column name="name" type="varchar(50)">
                <constraints nullable="false"/>
            </column>
            <column name="active" type="boolean" defaultValueBoolean="true"/>
        </createTable>
    </changeSet>

</databaseChangeLog>

除此之外,我还有一个酒鬼。特性:

driver=com.mysql.jdbc.Driver
classpath=lib/mysql-connector-java-5.1.41-bin.jar
url=jdbc:mysql://localhost/prime
username=bla
password=bla

我的pom。xml如下所示:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>himstedt</groupId>
    <artifactId>liquibase</artifactId>
    <version>1.0-SNAPSHOT</version>

    <dependencies>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.41</version>
        </dependency>
        <dependency>
            <groupId>org.liquibase</groupId>
            <artifactId>liquibase-core</artifactId>
            <version>3.5.3</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.liquibase</groupId>
                <artifactId>liquibase-maven-plugin</artifactId>
                <version>3.0.5</version>
                <configuration>
                    <propertyFile>src/main/resources/org/liquibase/liquibase.properties</propertyFile>
                    <changeLogFile>src/main/resources/org/liquibase/changelog.xml</changeLogFile>
                </configuration>
                <executions>
                    <execution>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>update</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

当我运行mvn包我得到以下错误:

user@desktop:~/IdeaProjects/liquibase$ mvn package
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building liquibase 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ liquibase ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 2 resources
[INFO] 
[INFO] --- liquibase-maven-plugin:3.0.5:update (default) @ liquibase ---
[INFO] ------------------------------------------------------------------------
[INFO] Parsing Liquibase Properties File
[INFO]   File: src/main/resources/org/liquibase/liquibase.properties
[INFO]   'classpath' in properties file is not being used by this task.
[INFO] ------------------------------------------------------------------------
Mon Mar 20 13:28:20 CET 2017 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
[INFO] Executing on Database: jdbc:mysql://localhost/prime
INFO 20.03.17 13:28:liquibase: null: null: Successfully acquired change log lock
SEVERE 20.03.17 13:28:liquibase: null: null: cvc-elt.1: Deklaration des Elements 'databaseChangeLog' kann nicht gefunden werden.
INFO 20.03.17 13:28:liquibase: null: null: Successfully released change log lock
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.909 s
[INFO] Finished at: 2017-03-20T13:28:20+01:00
[INFO] Final Memory: 19M/472M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.liquibase:liquibase-maven-plugin:3.0.5:update (default) on project liquibase: Error setting up or running Liquibase: Error parsing line 9 column 75 of src/main/resources/org/liquibase/changelog.xml: cvc-elt.1: Deklaration des Elements 'databaseChangeLog' kann nicht gefunden werden. -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

项目结构为:项目结构

对我来说,这似乎是模式的问题,但我仔细检查了一下,无法找出问题。很可能我在这里错过了一些非常明显的东西。

共有1个答案

胡博艺
2023-03-14

确保使用相同版本的liquibase core和liquibase maven插件。例如,将liquibase maven插件的版本设置为

 类似资料:
  • 问题内容: 我正在尝试获取一个bean对象以使用Spring Security验证用户登录功能: 我applicationContext.xml的如下: 但我得到这个异常: 我很难理解这个问题。 我对XML进行了如下更改: 我现在收到此异常: 问题答案: 你的默认名称空间是,http://www.springframework.org/schema/security并且你配置了它,xmlns:be

  • 目前,我正在为SOAP XML使用XSD,但当我在FREEFORMATTER上运行SOAP XML和XSD时。COM,我收到以下错误: Cvc-elt.1:找不到元素声明“肥皂:信封”...第1行,第170列 这是我的SOAP XML: 这是我的XSD: 我应该怎么做才能消除错误?

  • 问题内容: 我有弹簧罐,并试图 从此处给出的教程中实现程序。xml配置文件为: 主要: 我不知道这些豆怎么了。到目前为止,关于其他问题的任何建议都无济于事。有什么帮助吗? 问题答案: 假设您使用的是Spring 3.1,请尝试以下操作: 在最后一行用您使用的 主要 Spring版本替换。含义:即使有Spring版本,也没有XSD 。

  • 我有这个问题 XML格式的文档 我的XSD 我有个神经衰弱的问题。有什么想法吗? 问候

  • 在spring中,每当我在dispatcher-servlet.xml中编写时,我都会得到这样的错误:-

  • 我从GitHub获取了一个android项目,并将其克隆到了我的android Studio中。当我试图运行ActivityMain时。xml文件为了检查项目是否正常工作,我遇到了这个错误“找不到元素'RelativeLayout'的声明”。我不知道怎么解决这个问题。如果任何人有任何其他方式运行该项目,请建议太多。 github文件的链接如下所示 https://github.com/PedroC