강의

멘토링

로드맵

인프런 커뮤니티 질문&답변

seoyun jang님의 프로필 이미지
seoyun jang

작성한 질문수

ㅠㅠㅠ gradle 빌드시 에러

작성

·

4.2K

0

java11, springboot2.7.1로 프로젝트 진행했던 프로젝트를 열어 실행하니 에러가 발생합니다.

gradle 버전 문제인건지 아무리 찾아봐도 해결할 수 없습니다ㅠㅠ

gradle 버전 업그레드도 해보고, 라이브러리 추가하고 다 해봤는데 뭐가 문제인지 못찾겠습니다....

gradle build --info, debug를 했을때 아래와 같은 에러가 발생합니다

2023-03-28T15:16:27.880+0900 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
2023-03-28T15:16:27.882+0900 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] FAILURE: Build failed with an exception.
2023-03-28T15:16:27.883+0900 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
2023-03-28T15:16:27.883+0900 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * What went wrong:
2023-03-28T15:16:27.883+0900 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Execution failed for task ':compileJava'.
2023-03-28T15:16:27.883+0900 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Could not resolve all files for configuration ':compileClasspath'.
2023-03-28T15:16:27.883+0900 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]    > Could not find javax.xml.bind:jsxb-api:.
2023-03-28T15:16:27.883+0900 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]      Required by:
2023-03-28T15:16:27.883+0900 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]          project :
2023-03-28T15:16:27.883+0900 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
2023-03-28T15:16:27.883+0900 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Try:
2023-03-28T15:16:27.883+0900 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Run with --stacktrace option to get the stack trace.
2023-03-28T15:16:27.883+0900 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Run with --scan to get full insights.
2023-03-28T15:16:27.883+0900 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
2023-03-28T15:16:27.883+0900 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Get more help at https://help.gradle.org
2023-03-28T15:16:27.883+0900 [ERROR] [org.gradle.internal.buildevents.BuildResultLogger] 
2023-03-28T15:16:27.883+0900 [ERROR] [org.gradle.internal.buildevents.BuildResultLogger] BUILD FAILED in 2s
2023-03-28T15:16:27.884+0900 [LIFECYCLE] [org.gradle.internal.buildevents.TaskExecutionStatisticsReporter] 1 actionable task: 1 executed
2023-03-28T15:16:27.884+0900 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationRunner] Build operation 'Build finished for file system watching' started
  • 발생에러

11:46:16 AM: Executing ':RandomApplication.main()'...

> Task :compileJava FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.4.1/userguide/command_line_interface.html#sec:command_line_warnings
1 actionable task: 1 executed

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> Could not resolve all files for configuration ':compileClasspath'.
   > Could not find javax.xml.bind:jsxb-api:.
     Required by:
         project :

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 652ms
11:46:16 AM: Execution finished ':RandomApplication.main()'.
Execution failed for task ':compileJava'.
  > Could not resolve all files for configuration ':compileClasspath'.
    > Could not find javax.xml.bind:jsxb-api:.

Required by:
  project :
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
  • 시도

    java JDK 버전 확인, 빌드 자동 실행 설정 등.. 구글링해서 찾아봤으나 해결하지 못했습니다ㅠㅠ

  • 검색해보면 jaxb-api:. 를 기준으로 나오는데, 제 에러는 jsxb-api 입니다 이 둘의 차이는 무엇인가요?

답변 1

0

안녕하세요, 인프런 AI 인턴이에요.

에러 메시지를 보면 javax.xml.bind:jsxb-api: 라이브러리를 찾지 못해 발생한 문제로 보입니다. jsxb-api가 아닌 jaxb-api가 나오는 이유는 우리 프로젝트에 있던 오타로 인해 이 부분에서 발생한 것 같습니다.

또한 gradle 버전이 프로젝트와 호환되지 않는다는 경고도 나오니, 빌드를 실행할 때 gradle 버전도 확인해보세요.

해결 방법으로는 다음과 같은 것들이 있습니다.

  1. 프로젝트 내 build.gradle 파일에 repositories를 추가하세요.
repositories {
    mavenCentral()
}
  1. build.gradle 파일에서 jsxb-api를 jaxb-api로 대체하세요.
dependencies {
    compile group: 'javax.xml.bind', name: 'jaxb-api', version: '2.3.1'
    ...
}
  1. gradle 버전을 프로젝트와 호환 가능한 버전으로 업그레이드 하세요.

참고로, jsxb-api는 jaxb-api의 이전 버전으로, 현재는 더 이상 사용되지 않습니다.

위와 같은 방법으로도 문제 해결이 되지 않을 시, 다시 한번 에러 메시지와 함께 문의해주세요.

seoyun jang님의 프로필 이미지
seoyun jang

작성한 질문수

질문하기