加载maven时IDEA提示如下错误

加载maven时IDEA提示如下错误

https://img1.sycdn.imooc.com//climg/64a28abc0916a7f321681473.jpgjava.lang.RuntimeException: 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 'void <init>()' 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

at org.jetbrains.idea.maven.server.Maven3XServerEmbedder.getComponent(Maven3XServerEmbedder.java:514)

at org.jetbrains.idea.maven.server.Maven3XServerEmbedder.customizeComponents(Maven3XServerEmbedder.java:609)

at org.jetbrains.idea.maven.server.Maven3XServerEmbedder.customize(Maven3XServerEmbedder.java:571)

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.base/java.lang.reflect.Method.invoke(Method.java:566)

at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:359)

at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)

at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)

at java.base/java.security.AccessController.doPrivileged(Native Method)

at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)

at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:562)

at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:796)

at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:677)

at java.base/java.security.AccessController.doPrivileged(Native Method)

at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676)

at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)

at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)

at java.base/java.lang.Thread.run(Thread.java:834)

at java.rmi/sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:303)

at java.rmi/sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:279)

at java.rmi/sun.rmi.server.UnicastRef.invoke(UnicastRef.java:164)

at java.rmi/java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:217)

at java.rmi/java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:162)

at com.sun.proxy.$Proxy200.customize(Unknown Source)

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.base/java.lang.reflect.Method.invoke(Method.java:566)

at com.intellij.execution.rmi.RemoteUtil.invokeRemote(RemoteUtil.java:150)

at com.intellij.execution.rmi.RemoteUtil.access$400(RemoteUtil.java:21)

at com.intellij.execution.rmi.RemoteUtil$1.lambda$invoke$0(RemoteUtil.java:134)

at com.intellij.openapi.util.ClassLoaderUtil.computeWithClassLoader(ClassLoaderUtil.java:31)

at com.intellij.execution.rmi.RemoteUtil.executeWithClassLoader(RemoteUtil.java:202)

at com.intellij.execution.rmi.RemoteUtil$1.invoke(RemoteUtil.java:134)

at com.sun.proxy.$Proxy200.customize(Unknown Source)

at org.jetbrains.idea.maven.server.MavenEmbedderWrapper.doCustomize(MavenEmbedderWrapper.java:79)

at org.jetbrains.idea.maven.server.MavenEmbedderWrapper.onWrappeeCreated(MavenEmbedderWrapper.java:32)

at org.jetbrains.idea.maven.server.RemoteObjectWrapper.getOrCreateWrappee(RemoteObjectWrapper.java:42)

at org.jetbrains.idea.maven.server.MavenEmbedderWrapper.doCustomize(MavenEmbedderWrapper.java:79)

at org.jetbrains.idea.maven.server.MavenEmbedderWrapper.lambda$customizeForResolve$1(MavenEmbedderWrapper.java:52)

at org.jetbrains.idea.maven.server.RemoteObjectWrapper.perform(RemoteObjectWrapper.java:76)

at org.jetbrains.idea.maven.server.MavenEmbedderWrapper.customizeForResolve(MavenEmbedderWrapper.java:51)

at org.jetbrains.idea.maven.project.MavenProjectResolver.resolve(MavenProjectResolver.java:77)

at org.jetbrains.idea.maven.project.MavenProjectsProcessorResolvingTask.perform(MavenProjectsProcessorResolvingTask.java:45)

at org.jetbrains.idea.maven.project.MavenProjectsProcessor.doProcessPendingTasks(MavenProjectsProcessor.java:146)

at org.jetbrains.idea.maven.project.MavenProjectsProcessor$1.run(MavenProjectsProcessor.java:115)

at org.jetbrains.idea.maven.utils.MavenUtil.lambda$runInBackground$5(MavenUtil.java:524)

at com.intellij.util.RunnableCallable.call(RunnableCallable.java:20)

at com.intellij.util.RunnableCallable.call(RunnableCallable.java:11)

at com.intellij.openapi.application.impl.ApplicationImpl$1.call(ApplicationImpl.java:270)

at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)

at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)

at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)

at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)

at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)

at java.base/java.security.AccessController.doPrivileged(Native Method)

at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)

at java.base/java.lang.Thread.run(Thread.java:834)

Caused by: 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 'void <init>()' 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

at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:267)

at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:243)

at org.jetbrains.idea.maven.server.Maven3XServerEmbedder.getComponent(Maven3XServerEmbedder.java:511)

at org.jetbrains.idea.maven.server.Maven3XServerEmbedder.customizeComponents(Maven3XServerEmbedder.java:609)

at org.jetbrains.idea.maven.server.Maven3XServerEmbedder.customize(Maven3XServerEmbedder.java:571)

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.base/java.lang.reflect.Method.invoke(Method.java:566)

at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:359)

at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)

at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)

at java.base/java.security.AccessController.doPrivileged(Native Method)

at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)

at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:562)

at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:796)

at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:677)

at java.base/java.security.AccessController.doPrivileged(Native Method)

at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676)

at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)

at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)

... 1 more

Caused by: java.lang.RuntimeException: com.google.inject.ProvisionException: Unable to provision, see the following errors:


1) [Guice/ErrorInjectingConstructor]: NoSuchMethodError: DefaultModelValidator: method 'void <init>()' 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:

========================


at com.google.inject.internal.InternalProvisionException.toProvisionException(InternalProvisionException.java:251)

at com.google.inject.internal.InjectorImpl$1.get(InjectorImpl.java:1104)

at org.eclipse.sisu.inject.LazyBeanEntry.getValue(LazyBeanEntry.java:81)

at org.eclipse.sisu.plexus.LazyPlexusBean.getValue(LazyPlexusBean.java:51)

at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:263)

... 21 more

Caused by: java.lang.NoSuchMethodError: org.apache.maven.model.validation.DefaultModelValidator: method 'void <init>()' not found

at org.jetbrains.idea.maven.server.embedder.CustomModelValidator.<init>(CustomModelValidator.java:36)

at org.jetbrains.idea.maven.server.embedder.CustomModelValidator$$FastClassByGuice$$197107406.GUICE$TRAMPOLINE(<generated>)

at org.jetbrains.idea.maven.server.embedder.CustomModelValidator$$FastClassByGuice$$197107406.apply(<generated>)

at com.google.inject.internal.DefaultConstructionProxyFactory$FastClassProxy.newInstance(DefaultConstructionProxyFactory.java:82)

at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:114)

at com.google.inject.internal.ConstructorInjector.access$000(ConstructorInjector.java:33)

at com.google.inject.internal.ConstructorInjector$1.call(ConstructorInjector.java:98)

at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:109)

at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:124)

at com.google.inject.internal.ProvisionListenerStackCallback.provision(ProvisionListenerStackCallback.java:66)

at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:93)

at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:300)

at com.google.inject.internal.InjectorImpl$1.get(InjectorImpl.java:1101)

at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1139)

at org.eclipse.sisu.space.AbstractDeferredClass.get(AbstractDeferredClass.java:48)

at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:86)

at com.google.inject.internal.InternalFactoryToInitializableAdapter.provision(InternalFactoryToInitializableAdapter.java:57)

at com.google.inject.internal.ProviderInternalFactory$1.call(ProviderInternalFactory.java:67)

at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:109)

at org.eclipse.sisu.bean.BeanScheduler$CycleActivator.onProvision(BeanScheduler.java:230)

at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:117)

at com.google.inject.internal.ProvisionListenerStackCallback.provision(ProvisionListenerStackCallback.java:66)

at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:62)

at com.google.inject.internal.InternalFactoryToInitializableAdapter.get(InternalFactoryToInitializableAdapter.java:47)

at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)

at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:169)

at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:45)

at com.google.inject.internal.InjectorImpl$1.get(InjectorImpl.java:1101)

... 24 more

是否是当前IDEA与MAVEN版本不匹配的原因?maven版本为3.9.3,IDEA版本为2020.3.4

正在回答 回答被采纳积分+1

登陆购买课程后可参与讨论,去登陆

1回答
好帮手慕小蓝 2023-07-03 16:56:42

同学你好,这个错误确实通常是由于Maven和IDEA版本冲突导致的,同学可以尝试搜索一下3.8.1版本的Maven,这个版本在2020版本IDEA中是不冲突的。

或者同学也可以改用2023版本的IDEA,是可以兼容3.9版本Maven的。

祝学习愉快~

  • 提问者 weixin_慕雪2009890 #1

    引入mven3.8.1提示:

    Cannot resolve plugin org.apache.maven.plugins:maven-clean-plugin:2.5


    2023-07-03 22:17:30
  • 同学你好,通常这种情况是依赖下载不完整导致的,建议同学打开本地仓库,将对应依赖的文件夹删除,然后在IDEA中刷新Maven重新进行下载。

    如果依然存在问题,可以配置阿里云镜像来进行下载。

    <repositories>
        <repository>
            <id>aliyun</id>
            <name>aliyun</name>
            <url>https://maven.aliyun.com/repository/public</url>
        </repository>
    </repositories>

    另外,出现问题的是Maven的插件,与程序代码不会产生联系,所以这个错误并不会影响后续课程的学习,是可以忽略的。

    祝学习愉快~

    2023-07-04 09:41:29
问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
请稍等 ...
意见反馈 帮助中心 APP下载
官方微信

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师