I can do it(Feat. DEV)

[Maven]Fatal error compiling: invalid flag: --release 본문

개발자 모드/오류처리

[Maven]Fatal error compiling: invalid flag: --release

까짓거 해보자 개발자 2023. 8. 29. 15:11
728x90

오랜만에 Spring Boot 프로젝트를 만드려고 spring initializr 사이트에서 3.x 대 버전의 

 

Spring Boot 프로젝트를 선택하고 java 8 version으로 생성했음.

spring initializr
출처 : https://start.spring.io/

 

그런데 프로젝트를 intelliJ에서 import 하고 mvn package 명령어를 입력했는데

 

에러 내용
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.11.0:compile (default-compile) on project test: Fatal error compiling: invalid flag: --release -> [Help 1]

이와 같은 에러가 뜨면서 빌드가 실패함. 다른 메이븐 명령어도 동일.🤦‍♂️

 

아무것도 추가한 게 없는데 안되니 영문을 모르겠다 싶어 갓글에 검색.

 

갓글 曰 : 스프링 부트마다 호환되는 java 버전이 있음 > 3.x 버전은 최소 java17 버전 사용해야 함.

 

728x90

 

그래서 스프링 부트를 2.x 버전으로 내리고 사용하면 되겠다 싶었는데

 

어느 블로그들에서 말하기를 java8을 사용할 시 spring boot 2.1 이하 버전만 호환 가능한 걸로 나옴...❓

 

이것도 찾아보니 공식 문서에서 2.x 버전은 java 8을 사용할 수 있다고 명시되어 있음.👍(참조 사이트 참고)

 

즉, Spring Boot 2.x 까지는 java 8 호환 가능하며, 3.x 버전부터는 17 버전을 사용해야 함.

보통 메이저 버전 X.0에서 명시한 요구사항들은 마이너 버전에서 따로 명시하지 않는다고 함.😁

 

필자처럼 java8 버전을 사용하고 싶다면 Spring Boot 2.x 대 버전을 사용해 프로젝트를 생성하면 되겠음.👍

 

 

📢참조 사이트

 

https://okky.kr/questions/1445843

 

OKKY - java8 spring boot 호환 버전 질문있습니다.

안녕하세요구글링해서 나오는 블로그들에는java8을 사용할 시 spring boot 2.1 이하 버전만 호환 가능한걸로 나오는데공식 문서에서 찾아보니3.0에서 8 미지원은 찾았는데https://github.com/spring-projects/sp

okky.kr

https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.0-Release-Notes

 

Spring Boot 2.0 Release Notes

Spring Boot. Contribute to spring-projects/spring-boot development by creating an account on GitHub.

github.com

https://docs.spring.io/spring-boot/docs/2.7.12/reference/html/getting-started.html#getting-started.system-requirements

 

Getting Started

If you are getting started with Spring Boot, or “Spring” in general, start by reading this section. It answers the basic “what?”, “how?” and “why?” questions. It includes an introduction to Spring Boot, along with installation instructions.

docs.spring.io

 

728x90