에러일기

Dockerfile Error Could not resolve all dependencies for configuration ':runtimeClasspath'.> Failed to calculate the value of task ':compileJava' property 'javaCompiler'.

솜사탕코튼 2025. 2. 23. 17:45

 

Could not resolve all dependencies for configuration ':runtimeClasspath'.> Failed to calculate the value of task ':compileJava' property 'javaCompiler'.

  • 에러 메시지를 보면 gradle 빌드가 실패하는 이유는 Java 21을 찾을 수 없다는 것이였습니다.
  • Dockefile 에서 openjdk:21-jdk-alpine이미지가 Java 21을 제공하지 않는게 문제여서

다음과 같이 수정했습니다.

FROM eclipse-temurin:21-jdk-alpine  # 다른 OpenJDK 버전 사용 (예: Temurin)

# Copy application code into container
COPY . /app

# Set working directory to /app
WORKDIR /app

# Run Gradle build
RUN ./gradlew build

# Run the application (replace app.jar with your actual jar file name)
CMD ["java", "-jar", "app.jar"]