Plugin execution not covered by lifecycle configuration问题

今天在构建maven项目时,添加了一个编译插件

<plugins>
    <plugin>
        <groupId>org.apache.maven.pluginsgroupId>
        <artifactId>maven-compiler-pluginartifactId>
        <version>3.1version>
        <configuration>
            <source>1.8source> 
            <target>1.8target> 
        configuration>
    plugin>
plugins>

接着项目报如下错误:
Description Resource Path Location Type Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:3.6.0:testCompile (execution: default-testCompile, phase: test-compile) pom.xml /test line 47 Maven Project Build Lifecycle Mapping Problem
网上查了半天,各种说法都有。不过最终还是自己发现了关键问题:
没有加 标签啊是不是?完整的结构如下

<project>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.pluginsgroupId>
                <artifactId>maven-compiler-pluginartifactId>
                <version>3.1version>
                <configuration>
                    <source>1.8source> 
                    <target>1.8target> 
                    
                    
                    
                    
                    

                    
                    
                configuration>
            plugin>
        plugins>
    build>
project>

其次,相关子配置问题:问题配置如下

<plugin>
    <groupId>org.apache.maven.pluginsgroupId>
    <artifactId>maven-compiler-pluginartifactId>
    <version>3.1version>
    <configuration>
        <source>${maven.compiler.source}source>
        <target>${maven.compiler.target}target>
        <compilerId>eclipsecompilerId>
        <skip>testskip>
    configuration>
plugin>

删除compilerId配置,问题解决

<compilerId>eclipsecompilerId>

你可能感兴趣的:(问题笔记)