IDEA_NoSuchMethodError: DefaultModelValidator: method <init>()V not found

问题:

IDEA_NoSuchMethodError: DefaultModelValidator: method <init>()V not found

原错如下:

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

1) [Guice/ErrorInjectingConstructor]: NoSuchMethodError: DefaultModelValidator: method <init>()V not found
  at CustomModelValidator.<init>(CustomModelValidator.java:36)
  while locating CustomModelValidator
  at ClassRealm[maven.ext, parent: ClassRealm[plexus.core, parent: null]]
      \_ installed by: WireModule -> PlexusBindingModule
  while locating ModelValidator annotated with @Named(value=ide)

Learn more:
  https://github.com/google/guice/wiki/ERROR_INJECTING_CONSTRUCTOR

1 error

======================
Full classname legend:
======================
CustomModelValidator:  "org.jetbrains.idea.maven.server.embedder.CustomModelValidator"
DefaultModelValidator: "org.apache.maven.model.validation.DefaultModelValidator"
ModelValidator:        "org.apache.maven.model.validation.ModelValidator"
Named:                 "com.google.inject.name.Named"
PlexusBindingModule:   "org.eclipse.sisu.plexus.PlexusBindingModule"
WireModule:            "org.eclipse.sisu.wire.WireModule"
========================
End of classname legend:
========================

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

原因;

根据网的说法是maven版本过高,idea版本低不兼容maven。

解决方法:

降低maven,或者升级idea。

方法可行性具体没测试,但是配置低版本maven确实运行无错。

猜你喜欢

转载自blog.csdn.net/weixin_45728126/article/details/129279018