【技巧】“Plugin execution not covered by lifecycle configuration...“异常的处理

问题现象:

      在Eclipse(JEE mars)中新建maven project,选择archetype为:maven-archetype-plugin,结果生成的project存在错误:“Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-plugin-plugin:3.2:descriptor (execution: default-descriptor, phase: process-classes) pom.xml

原因分析:

      选择新建的项目,右键-properties-Maven-LifecycleMapping,会看到“plugin:descriptor(default-descriptor)”对应的mapping是error,说明在缺少映射。

解决办法:

      打开windows-preferences-Maven-Lifecycle Mapping,点击“Open workspace lifecycle mappings metadata”,如果原来没有设置过,会打开一个空文件编辑窗口。输入以下内容:

<?xml version="1.0" encoding="UTF-8"?>
<lifecycleMappingMetadata>
    <pluginExecutions>
        <pluginExecution>
            <pluginExecutionFilter>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-plugin-plugin</artifactId>
                <goals>
                    <goal>descriptor</goal>
                </goals>
                <versionRange>[3.2,)</versionRange>
            </pluginExecutionFilter>
            <action>
                <ignore />
            </action>
        </pluginExecution>
    </pluginExecutions>
</lifecycleMappingMetadata>

保存到你希望的位置,然后在“Change mapping file location”下面的输入框中输入刚才保存的文件路径,然后点击“Reload workspace lifecycle mapping metadata”。

接下来,选中新建的Project,右键-Maven-Update Project...-OK,系统重新编译该项目,异常消失。

如果发现还有类似的其他异常,应该在上面的mapping文件中<goals>标签下增加其他<goal>。

你可能感兴趣的:(【技巧】“Plugin execution not covered by lifecycle configuration...“异常的处理)