今天遇到一个奇怪的问题,在maven工程下运行任何mvn命令都报“Internal error: java.lang.ArrayIndexOutOfBoundsException”错误,具体错误如下:
$ mvn install
[INFO] Scanning for projects...
[ERROR] Internal error: java.lang.ArrayIndexOutOfBoundsException: 21329 -> [Help 1]
org.apache.maven.InternalErrorException: Internal error: java.lang.ArrayIndexOutOfBoundsException: 21329
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:121)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 21329
at org.codehaus.plexus.util.xml.pull.MXParser.parsePI(MXParser.java:2502)
at org.codehaus.plexus.util.xml.pull.MXParser.nextImpl(MXParser.java:1283)
at org.codehaus.plexus.util.xml.pull.MXParser.next(MXParser.java:1131)
at org.codehaus.plexus.util.xml.pull.MXParser.nextTag(MXParser.java:1116)
at org.apache.maven.model.io.xpp3.MavenXpp3ReaderEx.parsePluginExecution(MavenXpp3ReaderEx.java:3264)
at org.apache.maven.model.io.xpp3.MavenXpp3ReaderEx.parsePlugin(MavenXpp3ReaderEx.java:3059)
at org.apache.maven.model.io.xpp3.MavenXpp3ReaderEx.parseBuild(MavenXpp3ReaderEx.java:987)
at org.apache.maven.model.io.xpp3.MavenXpp3ReaderEx.parseModel(MavenXpp3ReaderEx.java:2512)
at org.apache.maven.model.io.xpp3.MavenXpp3ReaderEx.read(MavenXpp3ReaderEx.java:4350)
at org.apache.maven.model.io.xpp3.MavenXpp3ReaderEx.read(MavenXpp3ReaderEx.java:560)
at org.apache.maven.model.io.DefaultModelReader.read(DefaultModelReader.java:121)
at org.apache.maven.model.io.DefaultModelReader.read(DefaultModelReader.java:94)
at org.apache.maven.model.building.DefaultModelProcessor.read(DefaultModelProcessor.java:81)
at org.apache.maven.model.building.DefaultModelBuilder.readModel(DefaultModelBuilder.java:529)
at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:269)
at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:469)
at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:438)
at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:401)
at org.apache.maven.graph.DefaultGraphBuilder.collectProjects(DefaultGraphBuilder.java:419)
at org.apache.maven.graph.DefaultGraphBuilder.getProjectsForMavenReactor(DefaultGraphBuilder.java:410)
at org.apache.maven.graph.DefaultGraphBuilder.build(DefaultGraphBuilder.java:83)
at org.apache.maven.DefaultMaven.buildGraph(DefaultMaven.java:491)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:219)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
... 11 more
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
- 网上有人说说是pom.xml文件错误,第一行缺少下面行,但是加上后问题依旧。
<?xml version="1.0" encoding="UTF-8" ?>
-
还有说是 ~/.m2/settings.xml 文件有错误,我干脆把这个文件删除了,问题还在。
-
最后抱着试试看的心态升级了一下maven版本,从原先3.3.3升级到3.8.8,问题解决了,但是具体原因还是不明。