Dev./persistence
[jooq] gradle 환경에서 java.lang.ClassNotFoundException: jakarta.xml.bind.annotation.XmlSchema가 발생하는 오류
인쥭
2022. 2. 8. 18:48
반응형
참고사항
원인
If the code generation fails with exceptions about not finding certain JAXB classes,
it is likely due to a 3rd-party plugin or your own build adding some dependency rules that enforce certain dependency versions that are not matching what is needed by the jOOQ code generation tool.
For example, the Spring Dependency Management Gradle plugin will downgrade the jakarta.xml.bind:jakarta.xml.bind-api dependency to a version not compatible with the jOOQ code generation tool and leads to the error below.
This issue provides some insights on how to debug such cases.
- 써드파티 플러그인 또는 개발자가 추가한 종속성 규칙이 jooq code generation에 필요한 종속성 버전과 맞지 않는 버전을 강제할 수 있다고 함.
- 예를 들어, io.spring.gradle:dependency-management-plugin 은 jooq의 code generation에 필요한 종속성인 jakarta.xml.bind:jakarta.xml.bind-api 을 호환되지 않는 버전으로 다운그레이드하며, 이로 인해 다음과 같은 버그 메시지가 발생할 수 있음.
대처
- 호환되는 버전으로 jakarta.xml.bind-api를 dependencies에 명시한다.
- 예를 들어, jakarta.xml.bind:jakarta.xml.bind-api:3.0.1 을 추가한 후 code generation을 다시 실행할 수 있다.
dependencies {
// 생략
jooqGenerator 'jakarta.xml.bind:jakarta.xml.bind-api:3.0.1' // 추가되었음
}