最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

m2eclipse - Eclipse gives me "Incompatible class files" error for my dependencies, even though the mvn build i

programmeradmin8浏览0评论

I'm currently using Eclipse 2024-12. I'm in the process of installing 2025-03, but my current situation is what 2024-12.

I work on a number of Maven SpringBoot applications. Yesterday I started making some revisions to a library that I've worked on before. I'm getting the following error:

Incompatible .class files version in required binaries. Project 'idp-srv-voltage-core' is targeting a 17 runtime, but is compiled against 'C:Users/dk068x/.m2/repository//glassfish/jersey/core/jersey-common/3.1.8/jersey-common-3.1.8.jar' (from the container 'Maven Dependencies') which requires a 21 runtime

Our projects require Java 17. Our dependency tree updated jersey-common to 3.1.8 quite a while ago, and we've seen no issues. The versions of dependencies are mostly determined by transient dependencies and our parent pom and bom referenced from there.

The command-line build for this library is working perfectly fine, it's only Eclipse that thinks it isn't building.

I tried an experiment and added a manual dependency spec for v3.1.6 of jersey-common. That sort of fixed the problem, but the error message simply changed to refer to a different artifact.

Another curious thing about that error message, although it's probably not an issue, is the "C:Users" in the path. I have no idea why the backslash is missing, but again, it's probably not a real issue.

Update:

I've determined that this is somehow caused by some dependency or dependencies in the tree. The parent pom and platform libraries we use were recently upgraded to newer versions. When I checkout the branch just before that change, it doesn't show this problem. When I go back to the new branch, the error appears again.

I note again, this is only happening in Eclipse. The mvn build is working fine for both old and new.

发布评论

评论列表(0)

  1. 暂无评论