如何在 Eclipse 中更新 Maven 存储库?
假设您已经在使用 m2eclipse 插件,当它没有更新对你的仓库中最新的?
例如,在命令行上,您只需添加 -U
标志(如
mvn clean install -U
…中所示)即可强制更新依赖项。 Eclipse中有类似的东西吗? (它似乎并不总是获取最新的更新。)
Assuming you're already using the m2eclipse plugin, what can you do when it doesn't update the dependencies to the latest in your repo?
For example, on the command line, you can just add the -U
flag as in
mvn clean install -U
…to force the dependencies to be updated. Is there something like this within Eclipse? (It doesn't always seem to pick up the latest updates.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
您可以右键单击您的项目,然后Maven >更新项目...,然后选择强制更新快照/版本复选框,然后单击“确定”。
You can right-click on your project then Maven > Update Project..., then select Force Update of Snapshots/Releases checkbox then click OK.
在使用 M2E 插件的较新版本的 Eclipse 中,它是:
右键单击您的项目 -->梅文 -->更新项目...
在以下对话框中有一个用于强制更新的复选框(“强制更新快照/版本”)
In newer versions of Eclipse that use the M2E plugin it is:
Right-click on your project(s) --> Maven --> Update Project...
In the following dialog is a checkbox for forcing the update ("Force Update of Snapshots/Releases")
右键单击您的项目并选择
Maven >更新快照。除此之外,您还可以在
Window > 中设置“启动时更新 Maven 项目”。首选项> Maven
Right-click on your project and choose
Maven > Update Snapshots
. In addition to that you can set "update Maven projects on startup" inWindow > Preferences > Maven
有时,即使使用 m2eclipse 插件选中 Maven->Update Project->Force Update 选项,依赖项也不会更新。
如果它对其他人不起作用,此方法对我有用:
mvn eclipse:eclipse
这将使用新的依赖项更新您的 .classpath 文件,同时保留您的 .project 设置和其他 Eclipse 配置文件。
如果您出于某种原因想要清除旧设置,可以运行:
mvn eclipse:clean
mvn eclipse:eclipse
mvn eclipse:clean 将删除旧的设置,然后 mvn eclipse:eclipse 将创建新的 < em>.project、.classpath 和其他 eclipse 配置文件。
Sometimes the dependencies don't update even with Maven->Update Project->Force Update option checked using m2eclipse plugin.
In case it doesn't work for anyone else, this method worked for me:
mvn eclipse:eclipse
This will update your .classpath file with the new dependencies while preserving your .project settings and other eclipse config files.
If you want to clear your old settings for whatever reason, you can run:
mvn eclipse:clean
mvn eclipse:eclipse
mvn eclipse:clean will erase your old settings, then mvn eclipse:eclipse will create new .project, .classpath and other eclipse config files.
如果 Maven 更新快照不起作用,并且您有 Spring Tooling,一种有趣的方法是删除
注意:如果您使用其他任何东西,即 eclipse:eclipse 或 Spring Tooling,Maven 更新快照有时会停止工作
If Maven update snapshot doesn't work and if you have Spring Tooling, one interesting way is to remove
Note: Maven update snapshot sometimes stops working if you use anything else i.e. eclipse:eclipse or Spring Tooling