Eclipse Juno中的生命周期配置错误未涵盖插件执行 [英] Plugin execution not covered by lifecycle configuration error in Eclipse Juno

查看:77
本文介绍了Eclipse Juno中的生命周期配置错误未涵盖插件执行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么我的Maven构建在命令行上可以正常工作,但是当我在Eclipse中运行时,它要求我将此部分添加到pom.xml中,否则会出现此错误:

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:

Plugin execution not covered by lifecycle configuration
: org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile
 (execution: default-testCompile, phase: test-compile)

在"maven-compiler-plugin"插件周围发生这种情况并不奇怪吗?我在Google的任何地方都找不到像这样的其他问题,尽管我找到了许多有关第三方插件的修复建议.我已经进行了大量的研究和搜索,没有找到任何解释,甚至从这里都没有.

Isn't it strange that this occurs around the 'maven-compiler-plugin' plugin?? I cannot find another question like this anywhere on google, although I find many fix suggestions around 3rd party plugins. I've done a great deal of researching and searching and found no explanation of this, not even from here.

然后需要pom.xml来解决此问题:

And the pom.xml required to fix this:

<!--This plugin's configuration is used to store Eclipse m2e 
settings only. It has no influence on the Maven build itself.-->
    <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-compiler-plugin</artifactId>
                        <versionRange>[3.1,)</versionRange>
                        <goals>
                            <goal>testCompile</goal>
                        </goals>
                    </pluginExecutionFilter>
                    <action> 
                        <ignore></ignore>
                    </action>
                </pluginExecution>
            </pluginExecutions>
        </lifecycleMappingMetadata>
    </configuration>
</plugin>

而且这是我在GitHub上的简单项目,如果您想查看我的源代码. /p>

And , here is my simple project on GitHub if you want to see my source.

推荐答案

我终于解决了.似乎我上面发布的"pluginManagement"部分通常是Eclipse Maven项目所必需的,即使我拒绝了它,即使我在Internet上找不到的文档都没有明确提到这一点.

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.

此外,生命周期排除部分中的"versionRange"似乎也需要"gmaven-plugin"的版本号,而不是我上面试图提供的"Maven版本".

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>

这篇关于Eclipse Juno中的生命周期配置错误未涵盖插件执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆