maven pom文件报错:Multiple annotations found at this line 解决方案(转)
研究maven多模块项目时,因为家里和公司不能同时开发,所以把家里搭建好的项目复制到公司继续研究,
当时家里的电脑搭建好项目之后是没问题的,但是复制到公司的eclipse上之后就看到pom文件出现下面的错误:
Multiple annotations found at this line:
- Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile (execution: default-testCompile, phase: test-compile)
- Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (execution: default-compile, phase: compile)
- CoreException: Could not get the value for parameter compilerId for plugin execution default-compile: PluginResolutionException: Plugin org.apache.maven.plugins:maven-compiler-plugin:3.1 or one of its dependencies could not be
resolved: The repository system is offline but the artifact com.google.collections:google-collections:jar:1.0 is not available in the local repository.
- CoreException: Could not get the value for parameter compilerId for plugin execution default-testCompile: PluginResolutionException: Plugin org.apache.maven.plugins:maven-compiler-plugin:3.1 or one of its dependencies could not be
resolved: The repository system is offline but the artifact com.google.collections:google-collections:jar:1.0 is not available in the local repository.
网上搜罗一大堆都没找到解决办法,最后在一个英文文档找到了解决方案,翻译是这样的
这不是一个独特的问题,偶尔发生(有时由于连接缓慢,有时由于代理服务器现在允许下载)
你可以通过以下任何一种方式来摆脱这个问题:
1)强制更新:右键单击Eclipse中的项目> Maven >更新项目在该屏幕上选择快照/发布的复选框强制更新
2)清除Maven缓存:如果您仍然面临问题,请转到系统上的本地存储库,该库可能存在ATC:\\\用户\ MyUrNeNe\\M2\ReaviToRyy,并删除.cache文件夹,然后执行步骤1。
3)如果仍然面临问题,手动转到ORG/Apache文件夹,删除所有内容,然后执行步骤1。(这肯定会解决这个问题。)
我用了第三种方法,意思就是将你的maven仓库全删掉,重新下载一遍,使用以下流程:
1、找到你的maven仓库包位置,删掉repository文件夹下的所有文件,
2、然后右击项目->maven->update maven configuration...
offline和fore update of snapssots/Releases(强制更新)一定要勾选上,
下载完之后你会发现,问题解决了!!!
如果还不能解决,在pom文件加个依赖:
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.4.3</version>
</dependency>
这样就行了
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· Docker 太简单,K8s 太复杂?w7panel 让容器管理更轻松!