解决Maven报Plugin execution not covered by lifecycle configuration问题
问题:
在eclipse neon 中引入maven项目时,弹出两个错误,一个是jacco-maven-plugin,一个是项目中的插件ota-schema-plugin
如果忽略这两个错误,点击finish,坚持把工程导入到eclispe中。这时pom文件出现红叉号,
Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:jacoco-maven-plugin:0.7.4: (execution: default, phase: initialize)
解决问题:
官网给出解释及解决办法:http://wiki.eclipse.org/M2E_plugin_execution_not_covered
1. 方法一
<plugins> 标签外再套一个 <pluginManagement> 标签,
<build> <pluginManagement> <plugins> <plugin> ... </plugin> <plugin> ... </plugin> .... </plugins> </pluginManagement> </build>
2.方法二
点开有红叉号的pom文件,鼠标放到错误处,点击出现几个项,依次点击,目的是为了让eclipse ignore这些goal。这时会在workspace的lifecylemapping文件中自动加上下面的配置
<?xml version="1.0" encoding="UTF-8"?> <lifecycleMappingMetadata> <pluginExecutions> <pluginExecution> <pluginExecutionFilter> <groupId>com.travelsky.ota</groupId> <artifactId>ota-schema-plugin</artifactId> <versionRange>2.0.0</versionRange> <goals> <goal>generate</goal> </goals> </pluginExecutionFilter> <action> <ignore /> </action> </pluginExecution> <pluginExecution> <pluginExecutionFilter> <groupId>org.jacoco</groupId> <artifactId>jacoco-maven-plugin</artifactId> <versionRange>0.7.4.201502262128</versionRange> <goals> <goal>prepare-agent</goal> </goals> </pluginExecutionFilter> <action> <ignore /> </action> </pluginExecution> </pluginExecutions> </lifecycleMappingMetadata>
3.方法三
也可直接在workspace的lifecyclemapping文件中编辑,编辑完后,再reload worksapce lifecyclemapping