eclipse 为什么我会收到“使用 GWT 的生命周期配置未涵盖插件执行”错误?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8523737/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 20:46:41  来源:igfitidea点击:

Why am I receiving a "Plugin execution not covered by lifecycle configuration with GWT" error?

eclipsegwtmavenm2eclipsepom.xml

提问by Neets

I'm using STS and I imported a GWT project from another machine. The project uses m2eclipse. I'm getting these two errors when building the project:

我正在使用 STS 并且我从另一台机器导入了一个 GWT 项目。该项目使用m2eclipse。构建项目时出现这两个错误:

Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:gwt-maven-plugin:2.2.0:i18n (execution: default, phase: generate-sources)    pom.xml /contactsgwt    line 175
Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-war-plugin:2.1.1:exploded (execution: default, phase: compile)  pom.xml /contactsgwt    line 198

What's wrong? Is there any further configuration that needs to be done so the gwt maven pluginworks?

怎么了?是否有任何进一步的配置需要完成才能gwt maven plugin正常工作?

The pom.xmlcode causing the error:

pom.xml导致错误的代码:

<!-- GWT Maven Plugin -->
<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>gwt-maven-plugin</artifactId>
    <version>2.2.0</version>
    <executions>
        <execution>
            <goals>
                <goal>compile</goal>
                <goal>test</goal>
                <goal>i18n</goal>
            </goals>
        </execution>
    </executions>
    <!-- Plugin configuration. There are many available options, see gwt-maven-plugin documentation at codehaus.org -->
    <configuration>
        <runTarget>Contacts.html</runTarget>
        <hostedWebapp>${webappDirectory}</hostedWebapp
        <i18nMessagesBundle>es.indra.gwt.contactsgwt.client.ContactsMessages</i18nMessagesBundle>
    </configuration>
</plugin>

<!-- Copy static web files before executing gwt:run -->
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.1.1</version>
    <executions>
        <execution>
            <phase>compile</phase>
            <goals>
                <goal>exploded</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <webappDirectory>${webappDirectory}</webappDirectory>
    </configuration>
</plugin>

<plugin>
    <groupId>org.maven.ide.eclipse</groupId>
    <artifactId>lifecycle-mapping</artifactId>
    <version>0.9.9-SNAPSHOT</version>
    <configuration>
        <mappingId>generic</mappingId>
        <configurators></configurators>
        <mojoExecutions>
            <mojoExecution runOnIncremental="true">org.codehaus.mojo:gwt-maven-plugin:2.2.0:i18n</mojoExecution>
            <mojoExecution runOnIncremental="true">org.apache.maven.plugins:maven-resources-plugin:2.4.1:resources</mojoExecution>
            <mojoExecution runOnIncremental="false">org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile</mojoExecution>
            <mojoExecution runOnIncremental="false">org.apache.maven.plugins:maven-war-plugin:2.1.1:exploded</mojoExecution>
            <mojoExecution runOnIncremental="false">org.apache.maven.plugins:maven-resources-plugin:2.4.1:testResources</mojoExecution>
        </mojoExecutions>
    </configuration>
</plugin>

回答by ümit

If you use Eclipse Indigo (3.7) you have to activate the lifecycle plugin. See herefor more details.

如果您使用 Eclipse Indigo (3.7),您必须激活生命周期插件。请参阅此处了解更多详情。

Just add this pluginManagementsection to your buildsection of your pom.xmlfile

只需将此pluginManagement部分添加到您buildpom.xml文件部分

<pluginManagement>
    <plugins>
        <plugin>
            <groupId>org.eclipse.m2e</groupId>
            <artifactId>lifecycle-mapping</artifactId>
            <version>1.0.0</version>
            <configuration>
                <lifecycleMappingMetadata>
                    <pluginExecutions>
                        <pluginExecution>
                            <pluginExecutionFilter>
                                <groupId>org.codehaus.mojo</groupId>
                                <artifactId>gwt-maven-plugin</artifactId>
                                <versionRange>[2.4.0,)</versionRange>
                                <goals>
                                    <goal>resources</goal>
                                    <goal>compile</goal>
                                    <goal>i18n</goal>
                                    <goal>generateAsync</goal>
                                </goals>
                            </pluginExecutionFilter>
                            <action>
                                <execute />
                            </action>
                        </pluginExecution>
                        <pluginExecution>
                            <pluginExecutionFilter>
                                <groupId>org.apache.maven.plugins</groupId>
                                <artifactId>maven-war-plugin</artifactId>
                                <versionRange>[2.1.1,)</versionRange>
                                <goals>
                                    <goal>exploded</goal>
                                </goals>
                            </pluginExecutionFilter>
                            <action>
                                <execute />
                            </action>
                        </pluginExecution>
                    </pluginExecutions>
                </lifecycleMappingMetadata>
            </configuration>
        </plugin>
    </plugins>
</pluginManagement>