在使用Maven 3.8.5中导入Springboot 2.7项目时错误
使用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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
在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:

Apply and reload project.
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
我在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
我刚刚在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!