在POM配置Maven plugin提示錯誤「Plugin execution not covered by lifecycle configuration」的解決方案

eclipse在其POM文件的一處提示出錯以下:apache

Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (execution: default-compile, phase: compile)windows

這表示m2e在其執行maven的生命週期管理時沒有定義該插件,因此提示出錯,其實m2e對此是提供了擴展機制的,咱們能夠經過以下操做來消除這個出錯提示:網絡

方案1:app

1. 進入Window—>Preferences—>Maven配置,進入Lifecycle Mapping設置項,以下圖:eclipse

   

   從上圖能夠看出m2e管理maven生命週期的文件名是lifecycle-mapping-metadata.xml,以及該文件的存放路徑maven

2. 下一步咱們就要去相應路徑修改lifecycle-mapping-metadata.xml文件,但會發現這個文件在上圖中提示的位置並不存在,那麼此時就ui

以到eclipse的安裝目錄下的plugins下的org.eclipse.m2e.lifecyclemapping.defaults_xxxxxx.jar文件中找到該文件(以下圖):google

經過解壓軟件能夠發現lifecycle-mapping-metadata.xml文件的確在jar包中,把它從jar包中解壓出來並放置到前圖所示的路徑下插件

(若是找不到這個Jar,直接在Browse...,也就是你的工做空間的根目錄的.metadata/.plugins/org.eclipse.m2e.core/lifecycle-mapping-metadata.xmlcode

建立,保存一下這個文件。)

3. 打開lifecycle-mapping-metadata.xml文件,把未識別的插件在文件中加入便可:

 

4.修改完成後,需在Window—>Preferences—>Maven處把「Update Maven projects on startup」選項勾上,並重啓eclipse便可消除出錯示。

方案2

在pom.xml中在報錯的plugin的外面再包上一層<pluginManagement></pluginManagement>  以下:

<pluginManagement>

<plugins>
..........
</plugins>
    
</pluginManagement>
可是這個問題,不能根本解決,你還須要再次引用,否則不能使用這個插件。


 

方案3

在windows->Preferences->Maven->Error/Warnings下Ignore掉這個 plugin execution錯誤,以下圖:

 

方案4

一、打開eclipse或myeclipse的問題顯示窗口:'Window' -> 'Show View' -> 'Problems'

二、右擊一個顯示描述爲「 'Plugin execution not covered by lifecycle configuration: com.googlecode.mavenfilesync:maven-filesync-plugin:1.0.0:generate (execution: default, phase: initialize)'」的報錯信息,在彈出的菜單中選着「'Quick Fix'」

三、在Quick Fix窗口中,選中 'Permanently mark goal generate in pom.xml as ignored in Eclipse build',而後點擊 'Finish'-》選 'OK' 

四、Eclipse和myeclipse可能會報錯 'Projct configuration is not up-to-date with pom.xml. Run project configuration update'.按照上述方法,右擊「quick Fix」解決

五、重複 2-3步驟解決其餘的問題

 

以上方法來自網絡,僅供參考。

相關文章
相關標籤/搜索