简体   繁体   English

eclipse中刷新和更新项目有什么区别

[英]what is the difference between refresh and update project in eclipse

I use eclipse with maven integration for my java web application project. 我将Eclipse与Maven集成一起用于我的Java Web应用程序项目。 When you right click the project you can "refresh" the project. 右键单击项目时,可以“刷新”该项目。 You can also use "maven -> update project". 您也可以使用“ maven->更新项目”。 What is the difference between refresh and update? 刷新和更新有什么区别?

Sometimes I got a red-x sign in my pom file (I don't think there is any error). 有时我的pom文件中出现了red-x标志(我认为没有任何错误)。 When I use the "refresh", the red-x sign disappears. 当我使用“刷新”时,红色-x符号消失。 Any idea? 任何的想法?

Another question is that when I update the project, in the property -> deployment assembly, the maven dependencies was removed (I manually added them when I created the project). 另一个问题是,当我更新项目时,在属性->部署程序集中,maven依赖项已删除(在创建项目时手动添加了它们)。 How can I fix this? 我怎样才能解决这个问题?

Thanks 谢谢

A quick google search yielded this result: What does Maven Update Project do in Eclipse? 快速的Google搜索产生了以下结果: Maven Update Project在Eclipse中做什么?

The correct answer states: 正确答案指出:

It syncs the Eclipse project settings with that of the pom. 它将Eclipse项目设置与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. 例如,如果您更改重要的插件设置(例如输出的Java版本),则会发现Eclipse将要求您更新项目,此后,项目中已配置的Java运行时将进行更改以反映您的Maven pom指示。

That is an important thing to keep in mind: the Maven pom is the lead in this kind of project setup. 这是要记住的重要事项:Maven pom是这种项目设置的领导者。 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. 如果要更改设置,请尝试通过pom而不是直接通过Eclipse项目设置来进行更改,或者进行项目更新可能会还原您所做的更改。 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. 不过,通常我还是需要纠正一些事情,例如m2eclipse喜欢放入的构建路径排除项以及奇怪的部署程序集配置。

So in short, 简而言之,

  • Updating your project through maven synchronizes the settings with that of pom and keeps all the settings synchronized between the pom and the project. 通过maven更新项目可将设置与pom同步,并使所有设置在pom和项目之间保持同步。

  • Refreshing your project through eclipse will reload the project - that is reload all the files and apply any external changes from the files to the project. 通过eclipse刷新项目将重新加载项目-即重新加载所有文件,并将文件中的所有外部更改应用于项目。

Note that a maven update will cause a refresh of the project in eclipse. 请注意,Maven更新将刷新Eclipse中的项目。

FYI, here's what the official documentation states: 仅供参考,这是官方文件规定的内容:

Refresh command 刷新命令

The official Eclipse Oxygen documentation has two distinct (yet similar) definitions: 正式的Eclipse Oxygen文档具有两个不同的(但相似的)定义:

Update Project command 更新项目命令

Unfortunately, the only documented occurrence I have found in m2e documentation (see m2e 1.5 release notes ) is utterly insufficient and barely related: 不幸的是,我在m2e文档中发现的唯一记录的事件(请参阅m2e 1.5发行说明 )完全不足并且几乎没有关联:

The Update Maven Project dialog (launched via Right-click project menu:Maven[Update Project…] or via kbd:[Alt-F5]), now shows a dirty overlay on projects which need updating. 现在,“更新Maven项目”对话框(通过右键单击项目菜单:Maven [Update Project…]或通过kbd:[Alt-F5]启动)现在显示了需要更新的项目上的脏覆盖层。

Additionally, an “Add out-of-date” button adds all out-of-date (OOD) projects to the current selection. 此外,“添加过期”按钮会将所有过期(OOD)项目添加到当前选择中。 If an OOD project has not been selected, a warning is shown underneath the selection table with a link equivalent to “Add out-of-date”. 如果尚未选择OOD项目,则选择表下方会显示一条警告,并带有一个等效于“添加过期”的链接。 Warning text and “Add out-of-date” button tooltip show a count of unselected OOD projects. 警告文本和“添加过期”按钮的工具提示显示了未选择的OOD项目的数量。


Related questions on the 'Update Project' command (or the 'Update Maven Project' dialog): 有关“更新项目”命令(或“更新Maven项目”对话框)的相关问题:

(Which, alas, however insightful the best answers are, still provide no official statement from m2e developers.) (遗憾的是,最好的答案是多么有见地,但仍未提供m2e开发人员的官方声明。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 `Eclipse / Project / Clean ...`和`Eclipse / Project / Refresh(F5)`有什么区别? - What's the difference between `Eclipse/Project/Clean…` and `Eclipse/Project/Refresh (F5)`? Eclipse中的“ Java Project”和“ Project”选项有什么区别? - What is the difference between the “Java Project” and “Project” options in Eclipse? Eclipse中的JPA项目和EJB项目有什么区别? - What is difference between JPA Project and EJB Project in Eclipse? Eclipse Virgo和Eclipse Gemini有什么区别? - What is difference between Eclipse Virgo and Eclipse Gemini? Eclipse 3.7和Eclipse 4.1有什么区别? - What is the difference between Eclipse 3.7 and Eclipse 4.1? Maven项目与Eclipse中其他项目之间的区别 - Difference between maven project and other projects in Eclipse CacheStoreMode USE和REFRESH之间有什么区别 - What is the difference between CacheStoreMode USE and REFRESH Eclipse:'Revert'和'Override and Update'之间的区别 - Eclipse: Difference between 'Revert' and 'Override and Update' Eclipse动态Web项目IDE中的“Java Build Path”和“Deployment assembly”有什么区别? - What is the difference between “Java Build Path” and “Deployment assembly” in Eclipse dynamic web project IDE? 在任何java项目的eclipse构建路径中,项目和库之间有什么区别 - what is the difference between projects and libraries in eclipse's build path for any java project
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM