What happened when we perform Maven Update Project in Eclipse
Created by Wang, Jerry, last modified on Jul 20, 2016
我們初始把project 從github copy下來時,project facet是空的,這可以解釋,因為通過前面的分析,project facet信息時存放在.setting folder下面的那個文件里的,而那個文件沒有上傳到github上。當(dāng)選擇了Maven->Update project, Eclipse會解析pom.xml, 自動給該project 生成對應(yīng)的project facet
如何分析的呢?
首先我把練習(xí)那個project的project facet改成只剩Javascript一個:
Apply之后發(fā)現(xiàn)Run as server的選項消失了:
然后我做一次Maven update project,發(fā)現(xiàn)這里的help信息沒啥幫助:
然后我看到這個"Update project configuration from pom.xml", 覺得它有點關(guān)系,如何驗證我的猜想?我先把這個勾去掉:
Update完之后發(fā)現(xiàn)仍無變化:
然后我再做一次,這次把這個勾選上:
這次,發(fā)現(xiàn)所有的project facet都正確地determine出來了,印證了我的猜想。
Further investigation needed
update應(yīng)該還有其他用途,加載包之類的,經(jīng)常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.
總結(jié)
以上是生活随笔為你收集整理的What happened when we perform Maven Update Project in Eclipse的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 崩坏三哪些武器不能造成流血伤害
- 下一篇: Inside Spring - lear