헤르메스 LIFE

[Exception] Build failed with an exception 본문

Exception

[Exception] Build failed with an exception

헤르메스의날개 2024. 7. 31. 09:37
728x90

개발환경 셋팅 중 아래와 같은 오류가 발생하였습니다.

기술의 발전은 빠른데, 따라 가기 힘드네요. ㅠ.ㅠ

STS에서 "https://start.spring.io" 를 통해 Springboot 신규 프로젝트를 생성하면 Java version을 17 이하로는 선택할 수 없습니다. 하지만 우리는 JDK 8을 벗어난지도 최근입니다.


개발환경

JDK : zulu11.72.19-jdk11.0.23

Tools : STS 4.22.1.RELEASE

Spring : Spring Boot 2.7.18

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all dependencies for configuration ':compileClasspath'.
> Failed to calculate the value of task ':compileJava' property 'javaCompiler'.
   > Cannot find a Java installation on your machine matching this tasks requirements: {languageVersion=11, vendor=any, implementation=vendor-specific} for WINDOWS on x86_64.
      > No locally installed toolchains match and toolchain download repositories have not been configured.

* Try:
> Learn more about toolchain auto-detection at https://docs.gradle.org/8.8/userguide/toolchains.html#sec:auto_detection.
> Learn more about toolchain repositories at https://docs.gradle.org/8.8/userguide/toolchains.html#sub:download_repositories.
> 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.

CONFIGURE FAILED in 3s

build.gradle

plugins {
  id 'java'
  id 'org.springframework.boot' version '2.7.18'
  id 'io.spring.dependency-management' version '1.1.6'
}

group = 'EzPus'
version = '0.0.1-SNAPSHOT'

java {
  toolchain {
    languageVersion = JavaLanguageVersion.of(11)
  }
}

configurations {
  compileOnly {
    extendsFrom annotationProcessor
  }
}

repositories {
  mavenCentral()
}

dependencies {
  implementation 'org.springframework.boot:spring-boot-starter-data-redis'
  compileOnly 'org.projectlombok:lombok'
  developmentOnly 'org.springframework.boot:spring-boot-devtools'
  annotationProcessor 'org.projectlombok:lombok'
  testImplementation 'org.springframework.boot:spring-boot-starter-test'
  testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}

tasks.named('test') {
  useJUnitPlatform()
}

Gradle 이 JDK 버전을 인식하지 못하는 것 같습니다.

STS 환경이라 아래와 같이 설정하면 됩니다.

[ Windows >> Preferences >> Gradle > java home ]


https://hermeslog.tistory.com/658

 

[Spring & Spring Boot] 스프링 JDK 버전 호환

[Spring &  Spring Boot] 스프링 JDK 버전 호환개발환경을 셋팅하다보면 꼭 찾아보게되는 내용이라.. 정리해봤습니다.스프링 - JDK 버전 호환ReleaseVersionJDK비고2023.11Spring FrameWork 6.2.xJDK 17, 19, 21, 23,

hermeslog.tistory.com

 

728x90