maven plugin的execution出錯

Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-dependency-plugin:2.7:copy... 錯誤如上,有介紹解決方法java

org.eclipse.m2elifecycle-mapping1.0.0org.apache.maven.pluginsmaven-resources-plugin[2.0,)resourcestestResources

可這裏的maven插件與個人不同,又沒講清楚具體在哪裏改動了。繼續看,http://stackoverflow.com/questions/6352208/how-to-solve-plugin-execution-not-covered-by-lifecycle-configuration-for-sprin,這裏貌似羅嗦了這個錯誤的緣由, To solve some long-standing issues, m2e 1.0 requires explicit instructions what to do with all Maven plugins bound to "interesting" phases (see M2E interesting lifecycle phases) of project build lifecycle. We call these instructions "project build lifecycle mapping" or simply "lifecycle mapping" because they define how m2e maps information from project pom.xml file to Eclipse workspace project configuration and behaviour during Eclipse workspace build. Project build lifecycle mapping configuration can be specified in project pom.xml, contributed by Eclipse plugins and there is also default configuration for some commonly used Maven plugins shipped with m2e. We call these "lifecycle mapping metadata sources". m2e will create error marker like below for all plugin executions that do not have lifecycle mapping in any of the mapping metadata sources. Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-antrun-plugin:1.3:run   (execution: generate-sources-input, phase: generate-sources) m2e matches plugin executions to actions using combination of plugin groupId, artifactId, version range and goal. There are three basic actions that m2e can be instructed to do with a plugin execution --ignore, execute and delegate to a project configurator. 最終是這裏提到了怎麼解決 In my case of a similar problem, instead of using Andrew's suggestion for the fix, it worked simply after I introducedapache

tag to the pom.xml in question. Looks like that error is due to a missingtag. So, in order to avoid the exceptions in Eclipse, looks like one needs to simply enclose all the plugin tags inside atag, like so:..........我以前的結構是..........加上pluginManagement包裹起來後就沒有這個錯誤了。      好吧,這個解決方法領導不滿意,pluginManagement的做用是做爲公用的插件配置項,給子項目共用的。這個項目沒有子項目,這樣處理不是很合理,領導最終找到另外一種配置方式。去掉plugins標籤外的pluginManagement包裹,在plugins的上層加一個pluginManagement,與原先的plugin平行,針對出問題的插件增長單獨的配置,修改後的結構以下:.............pluginManagement內的詳細配置以下:org.eclipse.m2elifecycle-mapping1.0.0org.apache.maven.pluginsmaven-dependency-plugin[0.0.0,)copy好吧,問題算是合理地解決了。可有人比額領導還糾結,說這個配置不應放在pom文件裏,應該是ide來處理這個配置,就有了這個:http://liwenqiu.me/blog/2012/12/19/maven-lifecycle-mapping-not-converted/ 在eclipse->preference->maven->lifecycle mappings中,myeclipse的話Maven4MyEclipse->Lifecycle mappings,想上面所示進行配置,保存更新project。未試過eclipse下狀況如何,MyEclipse默認配置路徑是沒有lifecycle-mapping-metadata.xml這個文件的,只有<項目名>.lifecyclemapping一系列這樣的文件,但提供一個按鈕「Open workspace lifecycle mappings metadata」裏進行編輯。或者Change mapping file location。      好吧,這樣也許是最應該的處理的方式,但讓每一個開發人員都改下ide配置,還不如直接改下pom.xml文件的配置,最終採用了修改pom.xml文件的方式。      好吧,最終仍是將出錯緣由和解決思路抄一下: 基於maven的項目,使用各類maven plugin來完成開發中的各類工做,例如編譯代碼,打包,部署等等… 每一個plugin包含許多的goal,用來作特定的事情。典型的基於java的maven項目就有 clean compile test package deploy等goal要執行。除了這些比較常見的goal以外,項目中還可使用大量的第三方的plugin,甚至本身動手開發的plugin。 隨之而來的問題是,在eclipse中編輯maven項目的時候,eclipse並不知道這些goal要作什麼,通用的goal還好說,特殊用途的goal就沒有辦法了。因此m2eclipse這個集成maven到eclipse的plugin就提供了開發extra的能力,eclipse利用這些extra來完成原本在maven plugin要乾的活。 若是eclipse沒有辦法知道某個goal要幹什麼,那麼一般就會看到以下的錯誤信息: Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-dependency-plugin:2.6:copy (execution: default, phase: validate) 因爲我我的更傾向於在命令行下讓maven幹活,而eclipse更多的只是充當編輯器的角色,因此我要的只是讓eclipse忽略掉這些goal就行了。 參考這裏http://wiki.eclipse.org/M2E_plugin_execution_not_covered 以後,要作的就是告訴eclipse要忽略的goal.
相關文章
相關標籤/搜索