简体   繁体   中英

Liquibase XmlElement error exception when running within gradle and Java13

Problem

I recently started using liquibase with Spring Boot (2.2.1). Build tool is gradle and JDK version is 13 . I've integrated liquibase plugin according to readme page on github.

I faced strange behaviour when I was starting liquibase tasks such as update (gradle update). 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.

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. 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. I solved this by adding liquibaseRuntime 'javax.xml.bind:jaxb-api', this is a part of my gradle script:

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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