在使用Maven 3.8.5中导入Springboot 2.7项目时错误

发布于 2025-02-08 22:11:46 字数 1044 浏览 2 评论 0原文

使用start.spring.io时 Springboot 2.7生成的项目带有MavenProject 3.8.5,该项目在Intellij中导入时会导致错误,这是很难调试或不自言自语的错误。

错误

java.lang.RuntimeException: org.codehaus.plexus.component.repository.exception.ComponentLookupException: com.google.inject.ProvisionException: Unable to provision, see the following errors:

1) Error injecting constructor, java.lang.NoSuchMethodError: org.apache.maven.model.validation.DefaultModelValidator: method 'void <init>()' not found
  at org.jetbrains.idea.maven.server.embedder.CustomModelValidator.<init>(Unknown Source)
  while locating org.jetbrains.idea.maven.server.embedder.CustomModelValidator
  at ClassRealm[maven.ext, parent: ClassRealm[plexus.core, parent: null]] (via modules: org.eclipse.sisu.wire.WireModule -> org.eclipse.sisu.plexus.PlexusBindingModule)
  while locating org.apache.maven.model.validation.ModelValidator annotated with @com.google.inject.name.Named(value="ide")

1 error
      role: org.apache.maven.model.validation.ModelValidator
  roleHint: ide

when Using start.spring.io
projects generated with springboot 2.7 comes with MavenProject 3.8.5 which when imported in intellij causes an error that is quite difficult to debug or not self speaking by itself.

The error

java.lang.RuntimeException: org.codehaus.plexus.component.repository.exception.ComponentLookupException: com.google.inject.ProvisionException: Unable to provision, see the following errors:

1) Error injecting constructor, java.lang.NoSuchMethodError: org.apache.maven.model.validation.DefaultModelValidator: method 'void <init>()' not found
  at org.jetbrains.idea.maven.server.embedder.CustomModelValidator.<init>(Unknown Source)
  while locating org.jetbrains.idea.maven.server.embedder.CustomModelValidator
  at ClassRealm[maven.ext, parent: ClassRealm[plexus.core, parent: null]] (via modules: org.eclipse.sisu.wire.WireModule -> org.eclipse.sisu.plexus.PlexusBindingModule)
  while locating org.apache.maven.model.validation.ModelValidator annotated with @com.google.inject.name.Named(value="ide")

1 error
      role: org.apache.maven.model.validation.ModelValidator
  roleHint: ide

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

终陌 2025-02-15 22:11:46

在Intellij 下,文件&gt; 设置&gt; 构建执行... &gt; 构建工具&gt; maven &gt; Maven Home Path 只需指向您的Maven目录:

申请和重新加载项目。

Under Intellij File > Setting > Build Execution... > Build tools > Maven > Maven home path just point to your maven directory:
enter image description here

Apply and reload project.

幼儿园老大 2025-02-15 22:11:46

That should have been fixed in 2022.1 in the scope of 此错误

请更新您的IDE

That should have been fixed in 2022.1 in the scope of this bug

Please update your IDE

千笙结 2025-02-15 22:11:46

我在stack:indues 2019.3,maven 3.8.6,JDK 1.8的错误中遇到了同样的错误。
因此,Change Maven到3.6.1解决了问题。

I had the same error with stack: IDEA 2019.3, Maven 3.8.6, JDK 1.8.
So, problem was resolved by change Maven to version 3.6.1

软的没边 2025-02-15 22:11:46

我刚刚在20分钟前遇到了我朋友的项目。解决方案非常完美。
如果您不想更新您的IDE(出于任何原因)或降级您的Maven版本,则只需要更改Maven Home Path :(文件|设置| build,...等。除“ ...包装器”外,所有列出的变体。
通常,我在c:/my-maven-folder/...包装器中使用分离的maven,所以我从来没有遇到过这样的问题。希望它有帮助!

I've just ran into this problem 20mins ago with my friend's project. The solution is just perfect.
If you don't want to update your IDE (for any reason) or downgrade yor Maven version, you just need to change your Maven Home path: (File | Settings | Build,...etc. | Build Tools | Maven) for any listed variant except "...wrapper".
Generally, I use separated maven in C:/my-maven-folder/...wrapper, so I've never had such a problem. Hope it helps!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文