Spring boot SpringLiquibase可从两个位置获得:spring引导中的错误
我正在尝试将spring boot与liquibase集成,但是当我运行应用程序时,它会抛出以下错误:Spring boot SpringLiquibase可从两个位置获得:spring引导中的错误,spring-boot,spring-data-jpa,build.gradle,liquibase,Spring Boot,Spring Data Jpa,Build.gradle,Liquibase,我正在尝试将spring boot与liquibase集成,但是当我运行应用程序时,它会抛出以下错误: An attempt was made to call the method liquibase.integration.spring.SpringLiquibase.setLiquibaseSchema(Ljava/lang/String;)V but it does not exist. Its class, liquibase.integration.spring.SpringLiqui
An attempt was made to call the method liquibase.integration.spring.SpringLiquibase.setLiquibaseSchema(Ljava/lang/String;)V but it does not exist. Its class, liquibase.integration.spring.SpringLiquibase, is available from the following locations:
jar:file:/C:/Users/Dev/.gradle/caches/modules-2/files-2.1/org.liquibase/liquibase-core/3.5.5/c65051f327382018bd09c30380f25eac96f210da/liquibase-core-3.5.5.jar!/liquibase/integration/spring/SpringLiquibase.class
It was loaded from the following location:
file:/C:/Users/Dev/.gradle/caches/modules-2/files-2.1/org.liquibase/liquibase-core/3.5.5/c65051f327382018bd09c30380f25eac96f210da/liquibase-core-3.5.5.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of liquibase.integration.spring.SpringLiquibase
这个问题似乎是由SpringBootStarter数据jpa给出的,只要我删除了依赖项,应用程序就可以正常运行。这是我的完整依赖项列表,但我还需要JPA来编写我的持久性类
dependencies {
compile('org.springframework.boot:spring-boot-starter-actuator')
compile 'org.springframework.boot:spring-boot-starter-web'
runtime('org.postgresql:postgresql:42.2.5')
compile 'org.webjars:bootstrap:4.1.3'
compile 'org.webjars:webjars-locator-core'
compile("org.springframework.boot:spring-boot-starter-data-jpa")
compile("org.hibernate:hibernate-entitymanager:4.3.4.Final")
compile("org.hibernate:hibernate-validator:6.0.16.Final")
compile ("org.hibernate:hibernate-core:5.4.1.Final")
testCompile 'org.springframework.boot:spring-boot-starter-test'
compile("org.liquibase:liquibase-core:3.5.5")
liquibaseRuntime 'org.liquibase:liquibase-gradle-plugin:2.0.1'
liquibaseRuntime 'org.liquibase:liquibase-groovy-dsl:2.0.2'
liquibaseRuntime "org.liquibase:liquibase-core:3.5.5"
liquibaseRuntime 'org.postgresql:postgresql:42.2.5'
}
知道为什么会出现不匹配吗?
提前感谢听起来像是两个不同的依赖项包含了一个重复的jar
Gradle中似乎有一个管理依赖项的插件,请看。从配置中删除该版本:
compile("org.liquibase:liquibase-core")
让Spring依赖关系管理为您解决这个问题。在我的例子中,升级到同时使用Spring Boot
2.1.0.RELEASE
和org.liquibase:liquibase核心:3.6.3
完全解决了这个问题。我在maven项目中通过在POM中删除liquibase版本就解决了这个问题
org.liquibase
液化酶核心
保持这种方式,不使用版本,其余部分由Spring处理