Maven Plugin execution not covered by lifecycle configuration

本文解决了一个常见的Maven项目构建问题,即由于maven-compiler-plugin配置不当导致的编译错误。通过在pom.xml文件中添加特定的配置解决了插件执行未被生命周期配置覆盖的问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

报错

配置私服之后,pom文件报错

Multiple annotations found at this line:
	- Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (execution: default-compile, phase: 
	 compile)
	- CoreException: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-compiler-plugin:2.5.1 or one of its dependencies could not be 
	 resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-compiler-plugin:jar:2.5.1: ArtifactResolutionException: Failure to transfer 
	 org.apache.maven.plugins:maven-compiler-plugin:pom:2.5.1 from http://localhost:8081/nexus/content/groups/public/ was cached in the local repository, resolution 
	 will not be reattempted until the update interval of nexusMirror has elapsed or updates are forced. Original error: Could not transfer artifact 
	 org.apache.maven.plugins:maven-compiler-plugin:pom:2.5.1 from/to nexusMirror (http://localhost:8081/nexus/content/groups/public/): The operation was cancelled.
	- Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:2.5.1:testCompile (execution: default-testCompile, 
	 phase: test-compile)

 

问题原因

无法下载maven插件或没有配置插件

解决办法

在pom.xml中添加如下配置,然后右键工程,选择“maven”-->‘Update ProjectConfiguration...’


<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.eclipse.m2e</groupId>
                <artifactId>lifecycle-mapping</artifactId>
                <version>1.0.0</version>
                <configuration>
                    <lifecycleMappingMetadata>
                        <pluginExecutions>
                            <pluginExecution>
                                <pluginExecutionFilter>
                                    <groupId>org.apache.maven.plugins</groupId>
                                    <artifactId>maven-resources-plugin</artifactId>
                                    <versionRange>[2.0,)</versionRange>
                                    <goals>
                                        <goal>resources</goal>
                                        <goal>testResources</goal>
                                    </goals>
                                </pluginExecutionFilter>
                                <action>
                                    <ignore />
                                </action>
                            </pluginExecution>
                        </pluginExecutions>
                    </lifecycleMappingMetadata>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>
</build> 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值