Maven运行任何命令都报错“Internal error: java.lang.ArrayIndexOutOfBoundsException”

今天遇到一个奇怪的问题,在maven工程下运行任何mvn命令都报"Internal error: java.lang.ArrayIndexOutOfBoundsException"错误,具体错误如下:

shell 复制代码
$ 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:
  1. 网上有人说说是pom.xml文件错误,第一行缺少下面行,但是加上后问题依旧。
xml 复制代码
<?xml version="1.0" encoding="UTF-8" ?>
  1. 还有说是 ~/.m2/settings.xml 文件有错误,我干脆把这个文件删除了,问题还在。

  2. 最后抱着试试看的心态升级了一下maven版本,从原先3.3.3升级到3.8.8,问题解决了,但是具体原因还是不明。

相关推荐
Evand J1 小时前
【MATLAB例程】TOA和AOA混合的高精度定位程序,适用于三维、N锚点的情况
开发语言·matlab
钮钴禄·爱因斯晨2 小时前
赛博算卦之周易六十四卦JAVA实现:六幺算尽天下事,梅花化解天下苦。
java
CHANG_THE_WORLD2 小时前
C++并发编程指南08
开发语言·c++·算法
wu_yi_min2 小时前
Spring Boot 日志:项目的“行车记录仪”
java·数据库·spring boot
小万编程2 小时前
【2025最新计算机毕业设计】基于SpringBoot+Vue爬虫技术的咖啡与茶饮料文化平台(高质量源码,可定制,提供文档,免费部署到本地)
java·vue.js·spring boot·毕业设计·课程设计·计算机毕业设计·项目源码
lsx2024063 小时前
Rust 条件语句
开发语言
怜渠客3 小时前
关于Java的HttpURLConnection重定向问题 响应码303
android·java
tingting01193 小时前
私有包上传maven私有仓库nexus-2.9.2
java·maven
天天向上杰3 小时前
简识JVM中并发垃圾回收器和多线程并行垃圾回收器的区别
java·jvm·算法