Plugin execution not covered by lifecycle configuration error in Eclipse Juno

后端 未结 3 1764
余生分开走
余生分开走 2021-02-07 13:10

Why does my Maven build work perfectly fine on the command line but when I run in Eclipse, it requires I add this section to my pom.xml, otherwise I get this error:

<         


        
相关标签:
3条回答
  • 2021-02-07 13:24

    You may require an M2E "connector" to understand maven-compiler-plugin using the Eclipse (JDT) compiler.

    Select "discover connectors" and choose M2E connector for Eclipse JDT compiler provided by JBoss, or install it manually.

    M2E connector for the Eclipse JDT Compiler 1.0.1.201209200903

    You may also be offered a Groovy connector -- maybe it uses similar technology under the hood? -- but unless you are using Groovy, it probably does not make sense to install such integration.

    0 讨论(0)
  • 2021-02-07 13:27
    1. Help -> Install new Software

      • Install the Groovy Compiler 2.2 / 2.1 Feature

      • Install Groovy-Eclipse M2E integration

    2. Window -> Preferences -> Maven -> Lifecycle Mappings -> Open workspace lifecycle mappings metadata

    Add the following xml:

    <?xml version="1.0" encoding="UTF-8"?>
    <lifecycleMappingMetadata>
        <pluginExecutions>
            <pluginExecution>
                <pluginExecutionFilter>
                    <groupId>org.codehaus.gmaven</groupId>
                    <artifactId>gmaven-plugin</artifactId>
                    <versionRange>[1.3,)</versionRange>
                    <goals>
                        <goal>compile</goal>
                        <goal>testCompile</goal>
                    </goals>
                </pluginExecutionFilter>
                <action>
                    <execute />
                </action>
            </pluginExecution>
        </pluginExecutions>
    </lifecycleMappingMetadata>
    
    1. Reload the Lifecycle Mappings and invoke a projekt update on your maven project. (ALT+F5)
    0 讨论(0)
  • 2021-02-07 13:40

    I finally solved it. It appears that the "pluginManagement" section I posted above is required by an Eclipse Maven project in general, even though I resisted it, and even though no documentation that I can find on the internet ever mentions this explicitly.

    ALso, the "versionRange" in the lifecycle exclusion section seems to also require the version number of the "gmaven-plugin" rather than the "version of Maven" which I was trying to give it above.

    <pluginExecutionFilter>
        <groupId>org.codehaus.gmaven</groupId>
        <artifactId>gmaven-plugin</artifactId>
        <versionRange>[1.5,)</versionRange>
        <goals>
            <goal>testCompile</goal>
            <goal>compile</goal>
        </goals>
    </pluginExecutionFilter>
    
    0 讨论(0)
提交回复
热议问题