What does Maven Update Project do in Eclipse?

元气小坏坏 提交于 2019-11-26 21:37:19

It syncs the Eclipse project settings with that of the pom. If you for example change important plugin settings, such as the output java version, you will find that Eclipse will ask you to update the project and afterwards the configured Java runtime in the project will have changed to reflect what your Maven pom indicates.

That is an important thing to keep in mind: the Maven pom is the lead in this kind of project setup. If you want settings to change, try to do that through the pom and not through Eclipse project settings directly or doing a project update might revert what you have changed. There are usually some things I have to correct myself anyway though, such as build path exclusions that m2eclipse likes to put in and strange deployment assembly configurations.

To add on to what @Gimby said - Update Project also provides more options such as Force Update of Snapshots / Releases which is extremely helpful when you have dependencies that are looking for the latest. (e.g.: [1.0) will find 1.0.* - whatever's the latest.)

Updating project is synonymous with Ivy's Resolve. It will make sure that all referenced dependencies are there, as well as clean the project to make sure that they are included correctly.

I could not dig out the documentaiton, but I was able to dig out the code. To complement @Gimby answer - you can go into details and look into what the function does in here:

https://github.com/eclipse/m2e-core/blob/41f5ae34ad2543ef1439b7fd7e0a03b596af8685/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/ProjectConfigurationManager.java#L365

Look for : updateProjectConfiguration0 function.

Cheers,

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!