본문 바로가기
  • A space that records me :)
기술/오류 해결 기록

[Spring boot] warning: unknown enum constant When.MAYBE

by yjkim_97 2023. 10. 13.
더보기

환경

  • spring boot v3
  • gradle
  • java 17


🚫 현상

어느날 부터 빌드할때 아래 경고 메시지가 계속 올라왔다..

에러는 아니지만 매우 거슬린다.

warning: unknown enum constant When.MAYBE
  reason: class file for javax.annotation.meta.When not found

 

 

✏️ 원인

@Nullable 어노테이션을 사용하면서 발생하는 문제로

이 경고는 javax.annotation.meta.When 프로젝트 런타임에서 열거형을 사용할 수 없기 때문에 발생한다고 한다.

 

 

🛠️ 해결 방안

이를 수정하려면 Google의 JSR305를 추가하면 된다.

 

build.gradle에 의존성 추가

dependencies {

    implementation 'com.google.code.findbugs:jsr305:3.0.2'

    ...
}

 

 

휴.. 이제 빌드할 때 편안해졌다..

 


Reference

https://stackoverflow.com/questions/53326271/spring-nullable-annotation-generates-unknown-enum-constant-warning

 

Spring nullable annotation generates unknown enum constant warning

In my app, whenever I add @Nullable (which imports from org.springframework.lang.Nullable) to any of the fields, I get a build warning: Warning:java: unknown enum constant javax.annotation.meta...

stackoverflow.com

https://stackoverflow.com/questions/11104667/java-compilation-error-using-findbugs-com-sun-tools-javac-code-symbolcompletio

 

java compilation error using findbugs. com.sun.tools.javac.code.Symbol$CompletionFailure: class file for javax.annotation.meta.W

I am trying to use the annotations of findbugs 1.3.2. I used the edu.umd.cs.findbugs.annotations.NonNull annotation in a simple test, and it works fine. However, now I have a large project, compo...

stackoverflow.com