[증상]

JDK24에서 mvn 실행시 아래와 같은 경고가 발생하고 프로젝트 빌드에 실패함

$ mvn clean spring-boot:run -Dspring-boot.run.profiles=local
WARNING: A terminally deprecated method in sun.misc.Unsafe has been called
WARNING: sun.misc.Unsafe::objectFieldOffset has been called by com.google.common.util.concurrent.AbstractFuture$UnsafeAtomicHelper (file:/opt/homebrew/Cellar/maven/3.9.9/libexec/lib/guava-33.2.1-jre.jar)
WARNING: Please consider reporting this to the maintainers of class com.google.common.util.concurrent.AbstractFuture$UnsafeAtomicHelper
WARNING: sun.misc.Unsafe::objectFieldOffset will be removed in a future release
[INFO] Scanning for projects...
[INFO] 
[INFO] ---------------< com.demo:sample >----------------
[INFO] Building sample 3.4.3-SNAPSHOT
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] Could not transfer metadata com.soundicly:jnanoid-enhanced:main-SNAPSHOT/maven-metadata.xml from/to maven-default-http-blocker (http://0.0.0.0/): Blocked mirror for repositories: [kpc-private (http://nexus.kpcard.co.kr/repository/maven-kpc-private-repositories/, default, releases+snapshots), kpc-public (http://nexus.kpcard.co.kr/repository/maven-public/, default, releases+snapshots)]
[WARNING] com.soundicly:jnanoid-enhanced:main-SNAPSHOT/maven-metadata.xml failed to transfer from http://0.0.0.0/ during a previous attempt. This failure was cached in the local repository and resolution will not be reattempted until the update interval of maven-default-http-blocker has elapsed or updates are forced. Original error: Could not transfer metadata com.soundicly:jnanoid-enhanced:main-SNAPSHOT/maven-metadata.xml from/to maven-default-http-blocker (http://0.0.0.0/): Blocked mirror for repositories: [kpc-private (http://nexus.kpcard.co.kr/repository/maven-kpc-private-repositories/, default, releases+snapshots), kpc-public (http://nexus.kpcard.co.kr/repository/maven-public/, default, releases+snapshots)]
[INFO] 
[INFO] --- clean:3.4.1:clean (default-clean) @ sample ---
[INFO] Deleting /Users/deepfree/development/workspace-java/sample/target
[INFO] 
[INFO] >>> spring-boot:3.4.3:run (default-cli) > test-compile @ sample >>>
[INFO] 
[INFO] --- spring-boot:3.4.3:build-info (build-info) @ sample ---
[INFO] 
[INFO] --- resources:3.3.1:resources (default-resources) @ sample ---
[INFO] Copying 19 resources from src/main/resources to target/classes
[INFO] Copying 71 resources from src/main/resources to target/classes
[INFO] 
[INFO] --- compiler:3.13.0:compile (default-compile) @ sample ---
[INFO] Recompiling the module because of changed source code.
[INFO] Compiling 101 source files with javac [debug parameters release 21] to target/classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.145 s
[INFO] Finished at: 2025-04-02T17:57:08+09:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.13.0:compile (default-compile) on project sample: Fatal error compiling: java.lang.ExceptionInInitializerError: com.sun.tools.javac.code.TypeTag :: UNKNOWN -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

 

[원인]

경고내용은 maven 3.9.9가 guava 33.2.1-jre.jar를 사용하는데 해당 버전의 guava가 terminally deprecated된 sun.misc.Unsafe를 호출한다는 내용입니다

 

guava에는 이미 이슈 "Migrate off Unsafe (guava-jre)"(https://github.com/google/guava/issues/6806)가 보고되어 guava-jre에처 처리되었는데 maven 3.9.9가 오래된 guava를 사용해서 발생하는 문제로 보입니다

 

해당 maven의 이슈도 Apache에 보고되어 https://issues.apache.org/jira/browse/MNG-8399?page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel&focusedCommentId=17939366 에서 찾을 수 있고, 4일전에 아래와 같은 댓글이 달려있고 maven에서 사용하는 guava 종속성을 업드레이드 할것으로 보입니다

 

[해결]

현재는 maven 하위의 file:/opt/homebrew/Cellar/maven/3.9.9/libexec/lib/guava-33.2.1-jre.jar 에 있는 guava library를 최신 버전으로 교체해볼수 있겠지만, maven 도구가 JDK 24에서 문제가 없게 라이브러리 종속성을 업데이트하면 maven을 업그레이드하면 될것으로 판단됩니다

 

추후 mavan 3.3.9에서 3.3.10이 릴리즈되면 확인해보고 이 게시물을 수정해 놓아야 겠습니다

 

 

+ Recent posts