如何更新Eclipse中的maven存储库?

时间:2022-07-11 23:57:01

Assuming you're already using the m2eclipse plugin, what can you do it doesn't update the dependencies to the latest in your repo.

假设您已经在使用m2eclipse插件,那么您可以做什么不会将依赖项更新为您的repo中的最新版本。

For example, on the command line you can just add the -U flag as in:

例如,在命令行上,您只需添加-U标志,如下所示:

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.)

...强制更新依赖项。 Eclipse中有这样的东西吗? (它似乎并不总能获得最新的更新。)

6 个解决方案

#1


80  

You can right-click on your project then Maven > Update Snapshots.

您可以右键单击项目,然后单击Maven> Update Snapshots。

#2


35  

In newer versions of Eclipse that use the M2E plugin it is:

在使用M2E插件的较新版本的Eclipse中,它是:

Right-click on your project(s) --> Maven --> Update Project...

右键单击您的项目 - > Maven - >更新项目...

In the following dialog is a checkbox for forcing the update ("Force Update of Snapshots/Releases")

在下面的对话框中有一个用于强制更新的复选框(“强制更新快照/版本”)

#3


20  

Right-click on your project and choose Maven > Update Snapshots. In addition to that you can set "update Maven projects on startup" in Window > Preferences > Maven

右键单击您的项目,然后选择Maven> Update Snapshots。除此之外,您还可以在Window> Preferences> Maven中设置“在启动时更新Maven项目”

UPDATE: In latest versions of Eclipse: Maven > Update Project. Make sure "Force Update of Snapshots/Releases" is checked.

更新:在Eclipse的最新版本中:Maven> Update Project。确保选中“强制更新快照/版本”。

#4


15  

Sometimes the dependencies don't update even with Maven->Update Project->Force Update option checked using m2eclipse plugin.

即使使用m2eclipse插件检查Maven-> Update Project-> Force Update选项,有时依赖项也不会更新。

In case it doesn't work for anyone else, this method worked for me:

如果它不适合其他任何人,这种方法对我有用:

  • mvn eclipse:eclipse

    mvn eclipse:eclipse

    This will update your .classpath file with the new dependencies while preserving your .project settings and other eclipse config files.

    这将使用新的依赖项更新.classpath文件,同时保留.project设置和其他eclipse配置文件。

If you want to clear your old settings for whatever reason, you can run:

如果您想出于任何原因清除旧设置,可以运行:

  • mvn eclipse:clean
  • mvn eclipse:干净
  • mvn eclipse:eclipse

    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.

    mvn eclipse:clean将擦除你的旧设置,然后mvn eclipse:eclipse将创建新的.project,.classpath和其他eclipse配置文件。

#5


2  

If Maven update snapshot doesn't work and if you have Spring Tooling, one interesting way is to remove

如果Maven更新快照不起作用,并且你有Spring Tooling,一种有趣的方法是删除

  • Right-click on your project then Maven > Disable Maven Nature
  • 右键单击您的项目,然后Maven>禁用Maven Nature
  • Right-click on your project then Spring Tools > Update Maven Dependencies
  • 右键单击您的项目,然后单击Spring Tools> Update Maven Dependencies
  • After "BUILD SUCCESS", Right-click on your project then Configure > Convert Maven Project
  • 在“BUILD SUCCESS”之后,右键单击您的项目,然后单击Configure> Convert Maven Project

Note: Maven update snapshot sometimes stops working if you use anything else i.e. eclipse:eclipse or Spring Tooling

注意:如果您使用其他任何东西,例如eclipse:eclipse或Spring Tooling,Maven更新快照有时会停止工作

#6


2  

On Intellij , right click Maven-> Reimport works fine

在Intellij上,右键单击Maven-> Reimport工作正常

#1


80  

You can right-click on your project then Maven > Update Snapshots.

您可以右键单击项目,然后单击Maven> Update Snapshots。

#2


35  

In newer versions of Eclipse that use the M2E plugin it is:

在使用M2E插件的较新版本的Eclipse中,它是:

Right-click on your project(s) --> Maven --> Update Project...

右键单击您的项目 - > Maven - >更新项目...

In the following dialog is a checkbox for forcing the update ("Force Update of Snapshots/Releases")

在下面的对话框中有一个用于强制更新的复选框(“强制更新快照/版本”)

#3


20  

Right-click on your project and choose Maven > Update Snapshots. In addition to that you can set "update Maven projects on startup" in Window > Preferences > Maven

右键单击您的项目,然后选择Maven> Update Snapshots。除此之外,您还可以在Window> Preferences> Maven中设置“在启动时更新Maven项目”

UPDATE: In latest versions of Eclipse: Maven > Update Project. Make sure "Force Update of Snapshots/Releases" is checked.

更新:在Eclipse的最新版本中:Maven> Update Project。确保选中“强制更新快照/版本”。

#4


15  

Sometimes the dependencies don't update even with Maven->Update Project->Force Update option checked using m2eclipse plugin.

即使使用m2eclipse插件检查Maven-> Update Project-> Force Update选项,有时依赖项也不会更新。

In case it doesn't work for anyone else, this method worked for me:

如果它不适合其他任何人,这种方法对我有用:

  • mvn eclipse:eclipse

    mvn eclipse:eclipse

    This will update your .classpath file with the new dependencies while preserving your .project settings and other eclipse config files.

    这将使用新的依赖项更新.classpath文件,同时保留.project设置和其他eclipse配置文件。

If you want to clear your old settings for whatever reason, you can run:

如果您想出于任何原因清除旧设置,可以运行:

  • mvn eclipse:clean
  • mvn eclipse:干净
  • mvn eclipse:eclipse

    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.

    mvn eclipse:clean将擦除你的旧设置,然后mvn eclipse:eclipse将创建新的.project,.classpath和其他eclipse配置文件。

#5


2  

If Maven update snapshot doesn't work and if you have Spring Tooling, one interesting way is to remove

如果Maven更新快照不起作用,并且你有Spring Tooling,一种有趣的方法是删除

  • Right-click on your project then Maven > Disable Maven Nature
  • 右键单击您的项目,然后Maven>禁用Maven Nature
  • Right-click on your project then Spring Tools > Update Maven Dependencies
  • 右键单击您的项目,然后单击Spring Tools> Update Maven Dependencies
  • After "BUILD SUCCESS", Right-click on your project then Configure > Convert Maven Project
  • 在“BUILD SUCCESS”之后,右键单击您的项目,然后单击Configure> Convert Maven Project

Note: Maven update snapshot sometimes stops working if you use anything else i.e. eclipse:eclipse or Spring Tooling

注意:如果您使用其他任何东西,例如eclipse:eclipse或Spring Tooling,Maven更新快照有时会停止工作

#6


2  

On Intellij , right click Maven-> Reimport works fine

在Intellij上,右键单击Maven-> Reimport工作正常