IDEA Maven 编译spark 项目遇到的问题 Could not initialize class org.apache.maven.wagon.providers.http.HttpWagon

在用IDEA 编译程序时,报了以下奇怪的错误:

constituent[39]: file:/C:/Application/apache-maven-3.8.6/lib/wagon-http-3.5.1-shaded.jar
constituent[40]: file:/C:/Application/apache-maven-3.8.6/lib/wagon-provider-api-3.5.1.jar
---------------------------------------------------
Exception in thread "DefaultMetadataResolver-0-1" java.lang.NoClassDefFoundError: Could not initialize class org.apache.maven.wagon.providers.http.HttpWagon$__sisu20
at    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at com.google.inject.internal.DefaultConstructionProxyFactory$ReflectiveProxy.newInstance(DefaultConstructionProxyFactory.java:126)
    at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:114)

 

 

 

 查了一下项目的project setting,使用的是JDK11,按理说不应该有此错误,再查了IDEA 的环境setting,里面的编译选项也是使用的JDK11版本,

最后发现,Maven 里的配置使用的是JDK8,原来因为本机安装了2个JDK,JAVA_HOME指向的是JDK8,Maven里使用的JDK 还是执行JAVA_HOME的,所以才报错,将配置改为JDK11后,错误不见了

 

posted @ 2022-09-09 11:18  黎明踏浪号  阅读(3733)  评论(0编辑  收藏  举报