如何强制intellij想法重读/更新pom文件中指定的所有依赖项?
当前回答
对于IntelliJ IDEA 14.0
项目>[您的项目名称]>右键单击> Maven >重新导入
其他回答
在最新的IntelliJ IDEA版本(2020.1.3终极版)中,在对pom.xml进行更改后,需要单击编辑器窗口右上方出现的这个小东西
这个小家伙太小了,位置也不显眼。我喜欢之前的版本,提醒显示在右下角。在此版本中仍然找不到启用自动导入的选项。
另一个选择
在右边的属性面板中,选择Maven并单击重新加载图标。如果右侧面板上没有maven,请从View > Tool Windows > maven中打开
打开“Maven Projects”选项卡/窗口,单击左上角的“Reimport All Maven Projects”,开始从它们的存储库中重新加载所有依赖项。状态栏显示该进程的相关信息。
是什么让你认为这是不正确的工作?也许任何依赖项都不能从存储库加载?
还有一个有用的设置告诉IntelliJ检查依赖项的新版本,即使版本号没有改变。我们有一个本地maven存储库和一个快照项目,它更新了几次,但版本号保持不变。问题是IntelliJ/Maven没有更新这个项目,因为版本号是固定的。
要启用检查变更的依赖关系,尽管版本号没有改变,请进入“Maven项目”选项卡,选择“Maven设置”,并在那里激活“始终更新快照”。
我遇到了一个问题,IntelliJ无法编译类,声称缺少项目之间的依赖关系。 按照这个问题的答案重新导入项目并不能解决问题。 我的解决方案是:
删除所有项目(项目标签/右键单击根文件夹/ maven /删除项目); 关闭编辑器; 在命令行上使用maven编译所有项目; 打开同一项目的编辑器; 再次将项目添加到maven (maven TAB /添加maven项目(绿色+)/选择根pom);
警告:在某些项目中,您可能必须增加maven导入的最大内存(maven选项卡/导入/导入器的VM选项中的maven设置)。
这在2022年仍然是一个问题。
The option Setting > Maven > Always update snapshots no longer works in IDEA 2022.2.2, probably because Maven 3 frowns upon it and IntelliJ seems to not have updated the IDE to make it function. A simple solution might be to be able to add maven -U clean install as a custom target to the Lifecycle list in the IDEA Maven tab, but if it is possible it is not clear how to do it (even after googling for days). A not as nice but viable solution would be to go into the Terminal tool of IDEA and typing maven -U clean install, but IDEA does not expose the maven command in its Terminal by default and again it is not clear how to configure it so that it would.
推荐文章
- 如何查看IntelliJ中的编译错误列表?
- Maven检查存储库中更新的依赖项
- 类未找到:IntelliJ中的空测试套件
- 我如何告诉Spring Boot哪个主类用于可执行jar?
- 什么是maven中的“pom”打包?
- Intellij IDEA Java类在保存时不能自动编译
- 在maven中安装mvn到底做什么
- 如何在POM.xml中引用环境变量?
- Android Studio中的。iml文件是什么?
- Maven project.build.directory
- Spring Boot -父pom,当你已经有一个父pom
- 为什么IntelliJ 13 IDEA从12版本升级后这么慢?
- 使用Maven复制文件的最佳实践
- Maven命令行如何指向特定的settings.xml为单个命令?
- intellij是否可以像在Eclipse中那样组织导入?