抽风的Maven、maven插件及配置
2024-10-21 09:43:24
Idea 配合 Maven使用中有时遇到莫名奇妙的问题,又莫名奇妙的恢复正常。整理如下:
1、删除系统环境变量Maven_Home,只需在IDEA中指定Maven及settings.xml即可。
有时,系统环境变量中的Maven和IDEA中指定Maven地址不一致时,IDEA会加载系统环境变量中的Maven settings.xml配置。
2、Invalidate Caches 清理缓存。
有时错误的缓存,或者在控制台手动执行过mvn命令,却未指定正确的settings.xml 导致依赖下载失败。
3、mirrorOf 排除
<mirror>
<id>aliyunmaven</id>
<mirrorOf>!central,*</mirrorOf>
<name>阿里云公共仓库</name>
<url>https://maven.aliyun.com/repository/public</url>
</mirror>
</mirrors>
合理排除其他repository,避免*全走阿里云。
4、删除apache-maven/conf 下默认的settings.xml配置。
5、maven插件Lifecycle下clean成功,install失败,依赖不去本地仓库找,非要上远程仓库找,各种无解。。。
"D:\Program Files\Java\jdk1.8.0_171\bin\java.exe" -Dmaven.multiModuleProjectDirectory=D:\project\RuoYi\ruoyi-system -Dmaven.home=D:\Software\apache-maven\apache-maven\apache-maven-3.6.1 -Dclassworlds.conf=D:\Software\apache-maven\apache-maven\apache-maven-3.6.1\bin\m2.conf "-Dmaven.ext.class.path=D:\Program Files\JetBrains\ideaIU-2021.1.3.win\plugins\maven\lib\maven-event-listener.jar" "-javaagent:D:\Program Files\JetBrains\ideaIU-2021.1.3.win\lib\idea_rt.jar=63782:D:\Program Files\JetBrains\ideaIU-2021.1.3.win\bin" -Dfile.encoding=UTF-8 -classpath D:\Software\apache-maven\apache-maven\apache-maven-3.6.1\boot\plexus-classworlds-2.6.0.jar org.codehaus.classworlds.Launcher -Didea.version=2021.1.3 -s D:\maven_repository\ruoyi_settings.xml install
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------------< com.ruoyi:ruoyi-system >-----------------------
[INFO] Building ruoyi-system 4.7.5
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.753 s
[INFO] Finished at: 2022-12-27T13:40:45+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project ruoyi-system: Could not resolve dependencies for project com.ruoyi:ruoyi-system:jar:4.7.5: Failed to collect dependencies at com.ruoyi:ruoyi-common:jar:4.7.5: Failed to read artifact descriptor for com.ruoyi:ruoyi-common:jar:4.7.5: Failure to find com.ruoyi:ruoyi:pom:4.7.5 in https://maven.aliyun.com/repository/public was cached in the local repository, resolution will not be reattempted until the update interval of public has elapsed or updates are forced -> [Help 1]
[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:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException Process finished with exit code 1
在 idea terminal 项目路径下执行
"D:\Program Files\Java\jdk1.8.0_171\bin\java.exe" -Dmaven.multiModuleProjectDirectory=D:\project\RuoYi\ruoyi-system -Dmaven.home=D:\Software\apache-maven\apache-maven\apache-maven-3.6.1 -Dclassworlds.conf=D:\Software\apache-maven\apache-maven\apache-maven-3.6.1\bin\m2.conf "-Dmaven.ext.class.path=D:\Program Files\JetBrains\ideaIU-2021.1.3.win\plugins\maven\lib\maven-event-listener.jar" "-javaagent:D:\Program Files\JetBrains\ideaIU-2021.1.3.win\lib\idea_rt.jar=63782:D:\Program Files\JetBrains\ideaIU-2021.1.3.win\bin" -Dfile.encoding=UTF-8 -classpath D:\Software\apache-maven\apache-maven\apache-maven-3.6.1\boot\plexus-classworlds-2.6.0.jar org.codehaus.classworlds.Launcher -Didea.version=2021.1.3 -s D:\maven_repository\ruoyi_settings.xml install -e
其实就是手动执行第一行,后面加参数 -e 可打印错误信息,没想到这就成功了。。看来maven插件这东西不靠谱多半有问题,还是手动执行实在。
最新文章
- 一些代码 II (ConfigParser、创建大文件的技巧、__getattr__和__getattribute__、docstring和装饰器、抽象方法)
- Windows XP SP3下编译安装openssl-1.1.0b
- How to Write and Publish a Scientific Paper: 7th Edition(科技论文写作与发表教程)(11.04更新)
- register_chrdev、register_chrdev_region以及alloc_chrdev_region之间的区别
- js类型判断
- 关于iOS9中配置App Transport Security(应用程序传输安全协议)
- VS2008调试技巧收集备用
- 1220. Stacks
- Yum 安装 zabbix...
- Three.js学习笔记 – “我和小伙伴都惊呆了”的特效和Three.js初探
- Oracle物化视图的用法与总结
- 网络数据传输安全及SSH与HTTPS工作原理
- 00002、div的文字垂直居中与背景的渐变
- Nagle算法
- Python 总结
- Eclipse 在启动发生错误异常:An internal error occurred during: ";Initializing Java Tooling";. java.lang.NullPointerException的解决办法
- matplotlib 刻度,坐标轴不可见
- JDBC-day01
- @Java中使用Jedis操作Redis之一
- SpringMVC源码剖析(五)-消息转换器HttpMessageConverter
热门文章
- python 快速搭建局域网文件服务器 SimpleHTTPServer http.server
- Java基础——(综合练习)选手打分
- Mysql-------查询各科成绩前三名的记录
- ZSTUOJ刷题④:Problem B.--输出双层金字塔
- js 基础篇--保留字
- 【python】python3.7与3.9共存,两个3版本同时存在(平时用vscode敲代码)pip复制
- Java 获取【.jar】文件里的资源文件
- AX2012 快速清空整个log表数据
- 3月1日Android开学学习
- CSS 语法-熟悉样式规则