如何强制intellij想法重读/更新pom文件中指定的所有依赖项?


当前回答

这在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.

其他回答

这在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.

对于单独的模块:右键单击模块的pom.xml -> Reload as Maven项目。

在最新的IntelliJ IDEA版本(2020.1.3终极版)中,在对pom.xml进行更改后,需要单击编辑器窗口右上方出现的这个小东西

这个小家伙太小了,位置也不显眼。我喜欢之前的版本,提醒显示在右下角。在此版本中仍然找不到启用自动导入的选项。

另一个选择

在右边的属性面板中,选择Maven并单击重新加载图标。如果右侧面板上没有maven,请从View > Tool Windows > maven中打开

对于IntelliJ IDEA 14.0

项目>[您的项目名称]>右键单击> Maven >重新导入

下面最左边的按钮(蓝色循环)也重新导入了所有的maven项目: