【问题标题】:Plugin execution not covered by lifecycle configuration maven error生命周期配置 Maven 错误未涵盖插件执行
【发布时间】:2012-07-11 23:52:08
【问题描述】:

我导入了一个现有的 maven 项目,但我在 pom.xml 中遇到了一些错误:

Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-

 compiler-plugin:2.3.2:compile (execution: default-compile, phase: compile) pom.xml 

 /org.squashtest.csp.tools.unittest line 50 Maven Project Build Lifecycle Mapping Problem

但我不明白为什么,

这是 pom.xml:

 <?xml version="1.0"?>
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org  
  /2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0   
  http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
<parent>
    <artifactId>squashtest-csp-tools</artifactId>
    <groupId>org.squashtest.tm</groupId>
    <version>1.2.0.RELEASE</version>
</parent>
<artifactId>org.squashtest.csp.tools.unittest</artifactId>
<name>Squashtest CSP - Tools module - Unit tests library</name>
<description>Library  of classes used for unit-testing other Squashtest        
     components</description>

<dependencies>
    <!-- ====== GROOVY ====== -->
    <dependency>
        <groupId>org.codehaus.groovy</groupId>
        <artifactId>groovy-all</artifactId>
        <scope>compile</scope>
    </dependency>
    <!-- ====== /GROOVY ====== -->
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>org.squashtest.org.hibernate.core</artifactId>
        <version>${hibernate.version}</version>
        <scope>compile</scope>
        <optional>true</optional>
    </dependency>
    <dependency>
        <groupId>org.unitils</groupId>
        <artifactId>unitils-database</artifactId>
        <version>3.1</version>
        <scope>compile</scope>
        <optional>true</optional>
        <exclusions>
            <exclusion>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-nop</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
</dependencies>
<build>
    <sourceDirectory>src/main/groovy</sourceDirectory>
    <testSourceDirectory>src/test/groovy</testSourceDirectory>
    <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-compiler-plugin</artifactId>
      <executions><execution></execution></executions>
      <version>2.3.2</version>
      </plugin> 
    </plugins>
 </build>
</project>

提前谢谢你

【问题讨论】:

  • 您在 pom 中有错字,并带有重复的执行标签。

标签: maven


【解决方案1】:

这是 Groovy maven 配置的问题。更具体地说,m2e 连接器问题通常是一场噩梦。此链接包含有关 the m2e connector mess 的详细信息。

总结

要解决这个问题,您可以使用 springsource 提供的 m2e 连接器。

http://dist.springsource.org/release/GRECLIPSE/e4.2/

详情

使用它:

  1. 点击帮助 > 安装新软件...
  2. 将上面的 URL 粘贴到“使用:”字段中
  3. 扩展“Groovy-Eclipse 的 m2e 配置器”
  4. 选择第一个选项“Groovy-Eclipse m2e Integration”并安装它

我还建议从 Eclipse Marketplace 安装“Groovy/Grails Tool Suite for Eclipse”(GGTS)。我刚刚在 Eclipse Kepler 中完成了这两项(安装 GGTS 然后是连接器),它解决了您在上面遇到的确切问题。此修复也适用于 Juno。

【讨论】:

  • 我想我每次安装 Groovy Eclipse 时都忘记安装这个 m2e 连接器了。
  • 我还必须安装 groovy 编译器,然后它完美运行。 ty
【解决方案2】:

在 Maven 中,在出现此错误之前需要检查的事项很少。

  1. 您可以从 .m2 存储库下载 jar 包吗? -> 为此只需删除 .m2 文件夹下的存储库文件夹并尝试更新 Maven 项目。然后您可以在 .m2 文件夹下看到新的 Repository 文件夹。 -> 检查所有 maven-plugin jar 是否位于 org/apache/maven 下

  2. 检查您是否能够打开您在 Settings.xml 文件中提到的存储库 url -> 在任何浏览器中打开这个网址,看看你是否能够打开。

  3. 有时第三方存储库 jar 可能已损坏。 -> 这将由第三方人员负责 -> 例如:如果您指向 Nexus 存储库,他们必须再次上传所需的 maven jar。上传 jar 文件时有时可能会损坏。

【讨论】:

    【解决方案3】:

    对我有用的是安装 M2E Groovy-Eclipse 集成,还为 maven 编译器插件添加更多配置,以便使用 java 和 groovy 类:

    <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <configuration>
           <compilerId>groovy-eclipse-compiler</compilerId>
           <source>1.7</source>
               <target>1.7</target>
        </configuration>
        <dependencies>
                    <dependency>
                        <groupId>org.codehaus.groovy</groupId>
                        <artifactId>groovy-eclipse-compiler</artifactId>
                        <version>2.8.0-01</version>
                    </dependency>
                    <dependency>
                        <groupId>org.codehaus.groovy</groupId>
                        <artifactId>groovy-eclipse-batch</artifactId>
                        <version>2.1.8-01</version>
                    </dependency>
        </dependencies>
    </plugin>
    

    【讨论】:

      【解决方案4】:

      我遇到了类似的问题。日食说

      生命周期配置未涵盖插件执行:org.apache.maven.plugins:maven-checkstyle-plugin:3.0.0:checkstyle(执行:默认,阶段:验证)

      去掉checkstyle后,出现了其他类似的问题。

      为了解决这个问题,我单击了快速修复选项:“发现新的 m2e 连接器”。 Eclipse 自动列出需要的内容。您所要做的就是单击“完成”按钮。

      我的 Eclipse 版本是 Oxygen.2(4.7.2)。希望这可以帮助。

      【讨论】:

        猜你喜欢
        • 2013-05-04
        • 2011-11-15
        • 2011-10-30
        • 2013-01-28
        • 2015-02-09
        • 2012-04-08
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多