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

无法通过spring maven项目集成和运行liquibase

黎曾笑
2023-03-14
$ mvn liquibase:update
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=386m; support was removed in 8.0
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building liquibase-samples 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- liquibase-maven-plugin:3.0.5:update (default-cli) @ liquibase-samples ---
[INFO] ------------------------------------------------------------------------
[INFO] Parsing Liquibase Properties File
[INFO]   File: src/main/resources/liquibase/liquibase.properties
[INFO] ------------------------------------------------------------------------
[INFO] Executing on Database: jdbc:postgresql://gsi-547576:5432/emp-db
INFO 5/15/17 4:30 PM:liquibase: null: null: Successfully acquired change log lock
SEVERE 5/15/17 4:30 PM:liquibase: null: null: cvc-elt.1: Cannot find the declaration of element 'databaseChangeLog'.
INFO 5/15/17 4:30 PM:liquibase: null: null: Successfully released change log lock
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.225 s
[INFO] Finished at: 2017-05-15T16:30:09-04:00
[INFO] Final Memory: 14M/1011M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.liquibase:liquibase-maven-plugin:3.0.5:update (default-cli) on project liquibase-samples: Error setting up or running Liquibase: Error parsing line 5 column 91 of src/main/resources/liquibase/db-changelog-master.xml: cvc-elt.1: Cannot find the declaration of element 'databaseChangeLog'. -> [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
<?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>com.study</groupId>
    <artifactId>liquibase-samples</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.liquibase</groupId>
            <artifactId>liquibase-core</artifactId>
            <version>3.5.3</version>
        </dependency>
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>9.3-1102-jdbc41</version>
            <scope>runtime</scope>
        </dependency>
    </dependencies>

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

</project>
driver=org.postgresql.Driver
url=jdbc:postgresql://localhost:5432/emp-db
username=abc
password=abc
    <?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"
                       xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
                            http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.4.xsd">
        <include file="liquibase/db-changelog-1.0.xml" relativeToChangelogFile="true"/> 
    </databaseChangeLog>

src/main/resources/liquibase/db-changelog-1.0.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"
                   xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
                        http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.4.xsd">

    <changeSet id="create_department" author="chandeln">
        <createTable tableName="department">
            <column name="id" type="int">
                <constraints primaryKey="true" nullable="false" />
            </column>
            <column name="name" type="varchar(50)">
                <constraints nullable="false" />
            </column>
        </createTable>
    </changeSet>

    <changeSet id="create_employee" author="chandeln">
        <createTable tableName="employee">
            <column name="id" type="int">
                <constraints primaryKey="true" nullable="false" />
            </column>
            <column name="emp_name" type="varchar(50)">
                <constraints nullable="false" />
            </column>
            <column name="dept" type="int"/>
        </createTable>
    </changeSet>

    <changeSet id="tag-1.0" author="sheng.w">
        <tagDatabase tag="1.0" />
    </changeSet>

</databaseChangeLog>

共有1个答案

邵凯定
2023-03-14

下面的帖子解决了我的问题。

Maven build与LiquiBase一起失败:找不到元素的CVC-ELT.1声明

依赖版本和插件版本都应该匹配。我的新pom如下所示。

<dependencies>
        <dependency>
            <groupId>org.liquibase</groupId>
            <artifactId>liquibase-core</artifactId>
            <version>3.5.3</version>
        </dependency>
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>9.3-1102-jdbc41</version>
            <scope>runtime</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.liquibase</groupId>
                <artifactId>liquibase-maven-plugin</artifactId>
                <version>3.5.3</version>
                <configuration>
                    <propertyFile>src/main/resources/liquibase/liquibase.properties</propertyFile>
                    <changeLogFile>src/main/resources/liquibase/db-changelog-master.xml</changeLogFile>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>update</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
 类似资料:
  • 我已经用maven和testNG配置了eclipse,用我的pom配置了PF。xml如下: 我是runnong,在命令提示符下点击这个目录:D:\EclipseWorkspace\iON27Feb2013\iONAutomation\common 我的cmd控制台显示:

  • 我对科特林来说是全新的。我已经安装了kotlin插件来eclipse。我在下面的一个教程中找到了一个简单的例子。问题是,当我运行项目时,我收到了以下声明的错误。 为了解决这个问题,我试图运行项目作为kotlin应用程序,但我找不到这个选项。 请让我知道如何修复此错误? 代码: 错误: 更新: 为了解决这个问题,我完全按照本教程中的内容,安装了最新版本的eclipse PHOTON,但问题仍然存在。

  • 我正在使用DB2 V10.5(windows),试图尝试使用Liquibase。 我正在使用liquibase-3.5.3-bin。我用以下参数设置了liquibase.properties文件。 我无法设置类路径使用多个罐。所以当我奔跑时 我得到了丢失snakeyaml jar的错误 我为类路径尝试的选项: 但不知何故,它不起作用。 当我运行Liquibase时,有人能建议我如何设置类路径,以便

  • 我有一个使用react js的项目构建,我想在本地执行它 到目前为止我所做的: 1) 已安装的节点。js(windows 64位) 2)从https://www.tutorialspoint.com/reactjs/reactjs_environment_setup.htm一直到步骤3 现在我有 1) c://program files/nodejs/node_模块 2)桌面/reactApp/n

  • 我试图通过npm安装gulp,这样我就可以运行我的项目。 据我所知,我所需要做的就是从项目位置的命令行运行“NPM install Gulp”,如下所示: 然而,它似乎不起作用,因为如果我从命令行运行“gulp”,什么也不会发生。 对不起,我对npm,咕噜,大口大口等都很陌生。:(

  • 我正在通过jenkins运行robot framework,但当我运行构建时,我会得到firefox错误 由用户匿名构建在工作区/var/lib/jenkins/jobs/rocko/workspace中启动 git rev-parse--is-inside-work-tree#timeout=10从远程git存储库获取更改git config remote.origin.url https://