简体   繁体   English

在 gradle 和 Java13 中运行时 Liquibase XmlElement 错误异常

[英]Liquibase XmlElement error exception when running within gradle and Java13

Problem问题

I recently started using liquibase with Spring Boot (2.2.1).我最近开始在 Spring Boot (2.2.1) 中使用 liquibase。 Build tool is gradle and JDK version is 13 .构建工具是gradleJDK版本是13 I've integrated liquibase plugin according to readme page on github.我已经根据 github 上的自述页面集成了liquibase 插件

I faced strange behaviour when I was starting liquibase tasks such as update (gradle update).当我开始 liquibase 任务(例如更新(gradle 更新))时,我遇到了奇怪的行为。 I received an Java NoClassDefFoundException for XmlElement attribute (sorry because I lost exact Exception stacktrace and message), but I solved this issue and would like to share my solution here.我收到了XmlElement 属性Java NoClassDefFoundException (抱歉,因为我丢失了确切的异常堆栈跟踪和消息),但我解决了这个问题,并想在这里分享我的解决方案。

Solution解决方案

It is well known issue when you move from Java 8 to Java 9 and upper and it solves by adding dependency to javax.xml.bind.当您从 Java 8 迁移到 Java 9 及更高版本时,这是众所周知的问题,它通过向 javax.xml.bind 添加依赖项来解决。 However when you deal with liquibase gradle plugin adding compile 'javax.xml.bind:jaxb-api' or runtime 'javax.xml.bind:jaxb-api' to dependency section doesn not helps.但是,当您处理 liquibase gradle 插件时,将 compile 'javax.xml.bind:jaxb-api' 或 runtime 'javax.xml.bind:jaxb-api' 添加到依赖项部分并没有帮助。 I solved this by adding liquibaseRuntime 'javax.xml.bind:jaxb-api', this is a part of my gradle script:我通过添加 liquibaseRuntime 'javax.xml.bind:jaxb-api' 解决了这个问题,这是我的 gradle 脚本的一部分:

dependencies {
   // my project dependencies
   // ...

   // liquibase plugin deps
   liquibaseRuntime 'org.liquibase:liquibase-core:3.8.1'
    liquibaseRuntime "jakarta.xml.bind:jakarta.xml.bind-api:2.3.2"
    liquibaseRuntime 'org.springframework.boot:spring-boot:2.2.1.RELEASE'
    //liquibaseRuntime 'org.liquibase:liquibase-groovy-dsl:2.0.1'
    liquibaseRuntime 'org.postgresql:postgresql:9.4.1211.jre7'
    liquibaseRuntime 'ch.qos.logback:logback-core:1.2.3'
    liquibaseRuntime 'ch.qos.logback:logback-classic:1.2.3'
    liquibaseRuntime sourceSets.main.output 
}

I hope my solution could help your to save your time.我希望我的解决方案可以帮助您节省时间。

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

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