6

Assuming you're already using the m2eclipse plugin, if you right-click on a Maven project there is a Maven submenu.

Two of the actions available in this submenu are:

  • Update dependencies
  • Update snapshots

I've found an answer that says that "Update snapshots" is equivalent to using the -U parameter for mvn.

If "update snapshots" is the same as mvn -U what does "update dependencies" do?

Community
  • 1
  • 1
Serxipc
  • 6,639
  • 9
  • 40
  • 51

2 Answers2

2

Snapshots are dependencies, but used slightly differently. Specific dependency is determined using group, name and version. These attributes can be identical for two different snapshots. Maven uses the latest snapshot based on internal time stamp.

Shapshots are beneficial during development of the project where you don't want to change its version but want your users to use the latest build.

So... "update dependencies" downloads dependencies you don't have, leaving the ones you have intact, "update snapshots" updates your snapshots in place to the latest build.

I hope this helps.

Eugene Ryzhikov
  • 17,131
  • 3
  • 38
  • 60
  • This does not happen on my eclipse installation. When I click on "Update dependencies" I can see that m2eclipse is downloading all the SNAPSHOT dependencies on the Maven Console view, the same as if a click "Update snapshots" – Serxipc Feb 27 '12 at 09:00
  • Yes... but snapshots and dependencies are different things and usually come from different repos – Eugene Ryzhikov Feb 27 '12 at 21:37
1

It largely depends on how snapshot updating policy is set in your environment. By default Maven is supposed to update snapshots once a day (hence the flag -U and "Update Snapshots" action to force the snapshot update), but this policy can be overwritten locally or at repository manager level.

The "Update Dependencies" does pretty much the same as "Update Snapshots" action, except forcing updating snapshot artifacts. Both actions reset in-memory project model created by M2E to keep track of dependencies, including those that came from Eclipse Workspace.

Eugene Kuleshov
  • 31,461
  • 5
  • 66
  • 67
  • I still don't see the difference. What updates are forced with "Update Dependencies" that "Update snapshots" doesn't do? – Serxipc Mar 21 '12 at 09:28
  • 1
    The "Update Dependencies" doesn't override any default policies, so no force there. – Eugene Kuleshov Mar 21 '12 at 13:58
  • So what "Update Dependencies" do is to clear the eclipse M2E project model and reload that. Then, depending on the update snapshots policy it may or may not update the snapshots from the repositories. It makes sense. – Serxipc Mar 22 '12 at 11:47