关键词:
【中文标题】无法通过我的 spring maven 项目集成和运行 liquibase【英文标题】:Not able to integrate and run liquibase through my spring maven project 【发布时间】:2017-10-14 18:59:39 【问题描述】:我正在尝试通过基于弹簧的maven
项目运行mvn liquibase:update
。但我看到以下错误。
错误:
$ 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
这是我的集成方式。
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>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>
src/main/resources/liquibase/liquibase.properties
driver=org.postgresql.Driver
url=jdbc:postgresql://localhost:5432/emp-db
username=abc
password=abc
src/main/resources/liquibase/db-changelog-master.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">
<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】:下面的帖子解决了我的问题。
Maven build failing with Liquibase: cvc-elt.1 declaration of element cannot be found
依赖版本和插件版本都应该匹配。我的新 pom 如下所示。
pom.xml
<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>
【讨论】:
无法在我的 Spring Boot 项目中使用 Maven 依赖项
】无法在我的SpringBoot项目中使用Maven依赖项【英文标题】:UnabletouseMavendependencyinsidemySpringbootproject【发布时间】:2020-09-2200:30:21【问题描述】:我已将我的工件发布到Maven。可以在这里访问->https://oss.sonatype.org/#nexus-search;classnam... 查看详情
MAVEN BUILD FAILURE - 无法解析项目 XYZ 的依赖关系
】MAVENBUILDFAILURE-无法解析项目XYZ的依赖关系【英文标题】:MAVENBUILDFAILURE-CouldnotresolvedependenciesforprojectXYZ【发布时间】:2015-01-1400:30:04【问题描述】:我正在集成jersey和spring,为此我有以下依赖项,但由于以下错误而无法构建:... 查看详情
Spring MVC 和 Maven 集成
】SpringMVC和Maven集成【英文标题】:SpringMVC&MavenIntegration【发布时间】:2013-12-2608:30:33【问题描述】:我正在尝试构建一个SpringMVC项目,但在尝试解决以下错误时遇到了一些麻烦。HTTP状态500-循环视图路径[登录]:将调度回再次... 查看详情
如何将 Spring Boot 项目集成到已经存在的多模块 Maven 项目中?
】如何将SpringBoot项目集成到已经存在的多模块Maven项目中?【英文标题】:HowtointegrateaSpringBootprojectintoanalreadyexistingmulti-moduleMavenproject?【发布时间】:2016-12-1709:26:35【问题描述】:我有一个多模块Maven项目,它有一个带有一系列... 查看详情
使用 Spring 在多模块 Maven 项目中进行集成测试
】使用Spring在多模块Maven项目中进行集成测试【英文标题】:IntegrationtestinginmultimoduleMavenprojectwithSpring【发布时间】:2021-07-2203:37:18【问题描述】:我有一个包含多个模块(父、服务、updater1、updater2)的多模块maven项目。@SpringBoot... 查看详情
java--spring和mybatis集成(代码片段)
Spring集成Mybatis主要使用的spring的IOC技术创建项目步骤:1、新建普通的maven项目 2、加入maven的依赖(1)spring依赖(2)mybatis依赖(3)mysql驱动(4)spring的事务依赖(5)mybatis 查看详情
使用 Spring 依赖项的 Maven 集成测试
】使用Spring依赖项的Maven集成测试【英文标题】:MavenIntegrationTestsWithSpringDependency【发布时间】:2015-08-3113:24:11【问题描述】:我有一个项目结构,其中有以下两个(Mavenized)项目:Database-这个项目是一个Spring项目,它管理与webap... 查看详情
4.spring集成mybatis(代码片段)
集成步骤创建maven项目加入maven依赖spring依赖mybatis依赖mysql驱动依赖spring事务依赖mybatis和spring集成依赖(mybatis官方提供的,用来在spring项目中创建mybatis的SqlSessionFactory,dao对象)创建实体类创建dao接口和mapper文件... 查看详情
intellijidea通过maven创建spring项目
1,创建maven项目,选择maven-archetype-webapp作为archetype,这样在项目结构里会自动生成web项目所需的一些文件和结构。、2,在pom.xml文件中加入spring的依赖包,根据自己需求加入所需的依赖包,如spring-web,spring-context-support,spring-webmv... 查看详情
使用 Maven 进行集成测试的最佳实践?
...述】:我有一个使用Maven构建的项目,它使用Hibernate(和Spring)从数据库等中检索数据。我在项目中对DAO的“测试”扩展了Spring的AbstractTransactionalDataSourceSpringContextTe 查看详情
Idea无法导入maven项目
】Idea无法导入maven项目【英文标题】:Ideaunableimportmavenproject【发布时间】:2020-01-1012:28:57【问题描述】:我的想法无法导入Maven项目,好像是openJDK引起的,但我不确定我使用springInitalizr来初始化一个简单的spring演示我的电脑配... 查看详情
Bamboo 在我的 Spring 项目中无法识别测试
】Bamboo在我的Spring项目中无法识别测试【英文标题】:Bamboodoesn\'trecognizetestinmySpringproject【发布时间】:2013-02-1808:29:45【问题描述】:我有一个托管在BitBucket上的Spring项目(ApacheCXF、Spring、Hibernate、Maven...),我正在尝试使用Bambo... 查看详情
无法理解 Spring Boot 如何使用 maven 管理集成测试。它是不是使用故障安全插件?
】无法理解SpringBoot如何使用maven管理集成测试。它是不是使用故障安全插件?【英文标题】:Can\'tunderstandhowSpringBootmanageintegrationtestswithmaven.Isitusesfailsafepluginornot?无法理解SpringBoot如何使用maven管理集成测试。它是否使用故障安全... 查看详情
集成 Spring JPA Data 和 Spring Cache 时的奇怪行为
...描述】:当我集成SpringJPAData和SpringCache时,出现了一个我无法解释的奇怪行为。我正在使用SpringBoot来设置我的演示项目。代码如下。我的配置bean:@Conf 查看详情
将 CSS 和图像链接到 Spring MVC maven 项目
...问题描述】:我有一个使用maven创建的Spring项目。以下是我的目录结构。我想在这个项目中添加css图像。为此,我在web-inf目录中创建了一个资源文件夹,并在其中放置了一个图像。在我的调度程序servletxml中,我添加了3行与mv 查看详情
使用spring的dwr3.0rc2启动项目时发生错误。
...把DWR引入到我的项目中,我的项目使用的是Spring4,我想通过使用注释的方法把DWR和Spring整合起来。我的项目使用的是Spring4,我试图通过使用注解方法将DWR与Spring集成。下面是我的集成工作代码,当我在Tomcat服务器上Stratup我的项... 查看详情
无法在 Spring Boot 中通过 RestTemplate 和 Eureka 使用 REST API
】无法在SpringBoot中通过RestTemplate和Eureka使用RESTAPI【英文标题】:NotabletoconsumeaRESTAPIthroughRestTemplateandEurekainSpringBoot【发布时间】:2018-05-0821:37:53【问题描述】:我可以在我的SpringBoot应用程序中通过Feign使用RESTAPI,但不能通过RestT... 查看详情
Maven 依赖于 Spring Boot 和 Junit
...5的项目。当我使用maven安装脚本执行测试时,它们会成功通过。但是当我尝试在eclipse中使用JUnit执行我的测试时,我遇到了以下问题:java.lang.SecurityExcepti 查看详情