環境
eclipse 4.3.0
maven 3.0.4
m2e 1.4.0
出現場景
之前的老項目,在個人環境(個人環境較新)下,別人老環境不報錯。
錯誤示例
一個錯誤示例,子項目引用了父項目,子項目parent標籤處報錯以下:
Multiple annotations found at this line:
- maven-enforcer-plugin (goal "enforce") is ignored by m2e.
- Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:aspectj-maven-plugin:1.3.1:compile (execution:
default, phase: compile)
解決辦法
官網給出解釋及解決辦法:http://wiki.eclipse.org/M2E_plugin_execution_not_covered
這裏有人說下面這樣也能夠解決, 即 <plugins> 標籤外再套一個 <pluginManagement> 標籤,我試驗是成功的:
http://stackoverflow.com/questions/6352208/how-to-solve-plugin-execution-not-covered-by-lifecycle-configuration-for-sprin
<build>
<pluginManagement>
<plugins>
<plugin> ... </plugin>
<plugin> ... </plugin>
....
</plugins>
</pluginManagement>
</build>
可是有時候父項目pom不能被修改,可用官網最後給出的解決辦法:
Window-Perferences-Maven-Lifecycle Mapping
保存以下內容:
<?xml version=
"1.0" encoding=
"UTF-8"?>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<goals>
<goal>compile</goal>
</goals>
<versionRange>[
1.
3,)</versionRange>
</pluginExecutionFilter>
<
action>
<ignore />
</
action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
記得點擊 」Reload workspace lifecycle mappings metadata「按鈕
問題解決。
(完)