前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >What happened when we perform Maven Update Project in Eclipse

What happened when we perform Maven Update Project in Eclipse

作者头像
Jerry Wang
发布2021-02-20 14:22:54
2430
发布2021-02-20 14:22:54
举报

Created by Wang, Jerry, last modified on Jul 20, 2016

我们初始把project 从github copy下来时,project facet是空的,这可以解释,因为通过前面的分析,project facet信息时存放在.setting folder下面的那个文件里的,而那个文件没有上传到github上。当选择了Maven->Update project, Eclipse会解析pom.xml, 自动给该project 生成对应的project facet 如何分析的呢? 首先我把练习那个project的project facet改成只剩Javascript一个:

clipboard1
clipboard1

Apply之后发现Run as server的选项消失了:

clipboard2
clipboard2

然后我做一次Maven update project,发现这里的help信息没啥帮助:

clipboard3
clipboard3

然后我看到这个"Update project configuration from pom.xml", 觉得它有点关系,如何验证我的猜想?我先把这个勾去掉:

clipboard4
clipboard4

Update完之后发现仍无变化:

clipboard5
clipboard5

然后我再做一次,这次把这个勾选上:

clipboard6
clipboard6

这次,发现所有的project facet都正确地determine出来了,印证了我的猜想。

clipboard7
clipboard7

Further investigation needed

update应该还有其他用途,加载包之类的,经常import出错后,update就可以了。还有昨天pom文件正确加了plugin之后,就在文件开头报个错,也没得错误消息,一update就没问题了,也看不出哪里变了啥

早有人问了: http://stackoverflow.com/questions/14992022/what-does-maven-update-project-exactly

http://stackoverflow.com/questions/20546962/what-does-maven-update-project-do-in-eclipse

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.

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2019-06-27 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • Created by Wang, Jerry, last modified on Jul 20, 2016
  • Further investigation needed
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档