- ①报错信息
Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
Error injecting: org.apache.maven.plugin.jar.JarMojo
Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:2.6:jar (default-jar) on project
hospital-drug: Execution default-jar of goal org.apache.maven.plugins:maven-jar-plugin:2.6:jar
failed: An API incompatibility was encountered while executing org.apache.maven.plugins:maven-jar-
plugin:2.6:jar: java.lang.ExceptionInInitializerError: null
Error injecting: org.codehaus.plexus.archiver.jar.JarArchiver
java.lang.ExceptionInInitializerError
at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0 (Native Method)
at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance (NativeConstructorAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance (DelegatingConstructorAccessorImpl.java:45)
②报错信息的翻译:
原因:java.lang.ArrayIndexOutOfBoundsException:索引1超出长度1的界限
注入错误:org.apache.maven.plugin.jar.JarMojo
未能执行goal org.apache.maven。plugins:maven-jar-plugin:2.6:jar(默认jar)在项目hospital drug上:执行
goal org.apache.maven的默认jar。plugins:maven-jar-plugin:2.6:jar失败:执行org.apache.maven时遇到API
不兼容。plugins:maven-jar-plugin:2.6:jar:java.lang.Exception初始化错误:无效的
注入错误:org.codehaus.plexus.archiver.jar.JarArchiver
java.lang.ExceptionInInitializeError错误
位于jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(本机方法)
在jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl。java:62)
在jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl。java:45)
- 原因
我查看了一下,发现是jdk版本出问题了,这个项目从github上git到idea中,它默认给我配置了jdk14了,项目运行的jdk版本没有那么高,需要使用jdk8,我换了jdk8就可以了 - 解决办法:更改jdk版本
File--Project Structure...--Project Settings--Project--Project SDK