Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:build-helper-maven-plugin:1.8:add-test-source (execution: add-functional-source, phase: generate-sources)

9804 ワード


mavenプロジェクトでadd-sourceを使用する場合pom.xmlは次のエラーを報告します.
Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:build-helper-maven-plugin:1.8:add-test-source (execution: add-functional-source, phase: generate-sources)

 
エラーコード箇所(赤マーク)

<plugin>
    <groupId>org.codehaus.mojogroupId>
    <artifactId>build-helper-maven-pluginartifactId>
    
        <execution>
            <id>add-functional-sourceid>
            <phase>generate-sourcesphase>
            <goals>
                <goal>add-test-sourcegoal>
            goals>
            <configuration>
                <sources>
                    <source>src/test/functionalsource>
                sources>
            configuration
        >
    executions>
plugin>

 
上記のコードをコメントした後、追加したコードは以下の通りです.
<pluginManagement>
    <plugins>
        
        <plugin>
            <groupId>org.eclipse.m2egroupId>
            <artifactId>lifecycle-mappingartifactId>
            <version>1.0.0version>
            <configuration>
                <lifecycleMappingMetadata>
                    <pluginExecutions>
                        <pluginExecution>
                            <pluginExecutionFilter>
                                <groupId>
                                    org.codehaus.mojo
                                groupId>
                                <artifactId>
                                    build-helper-maven-plugin
                                artifactId>
                                <versionRange>
                                    [1.8,)
                                versionRange>
                                <goals>
                                    <goal>add-sourcegoal>
                                goals>
                            pluginExecutionFilter>
                            <action>
                                <ignore>ignore>
                            action>
                        pluginExecution>
                    pluginExecutions>
                lifecycleMappingMetadata>
            configuration>
        plugin>
    plugins>
pluginManagement>

 
それからmaven->Update Projectでいいです
転載元:https://www.cnblogs.com/guyezhai/p/5629822.html