Maven 2.2.1 无法使用 m2eclipse 构建 EAR 项目

chr*_*ris 5 java eclipse ear m2eclipse maven

我在使用 m2eclipse 项目构建器在 Eclipse 3.6 中使用 Maven 构建 EJB EAR 时遇到问题。奇怪的是,手动构建(在命令行上或使用“Run as -> Maven build”)工作正常。我已将 Eclipse 设置为使用外部 Maven 2.2.1 安装。

错误信息如下:

Build errors for my-app; org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-ear-plugin:2.4.2:generate-application-xml (default-generate-application-xml) on project my-app: Failed to initialize ear modules
Run Code Online (Sandbox Code Playgroud)

因此,由于某些原因,我还无法确定 application.xml 描述符的生成显然失败了。

在错误日志视图中,我收到以下消息:

Unknown artifact type[test-jar]
Run Code Online (Sandbox Code Playgroud)

我在一个论坛中读到过,这可能是由缺少“test”范围的“test-jar”依赖引起的;但是,我对此进行了双重和三次检查,并且在我的 pom.xml 文件中找不到任何无作用域的“test-jar”依赖项。

我在 mvn help:effective-pom 中找到了以下条目:

  <dependency>
    <groupId>org.jboss.test</groupId>
    <artifactId>jboss-test</artifactId>
    <version>1.1.4.GA</version>
    <exclusions>
      <exclusion>
        <artifactId>log4j</artifactId>
        <groupId>apache-log4j</groupId>
      </exclusion>
    </exclusions>
  </dependency>

  <!-- ... --->

  <dependency>
    <groupId>jboss.jms-integration-tests</groupId>
    <artifactId>integration-mdb20</artifactId>
    <version>1.0.1.GA</version>
  </dependency>
  <dependency>
    <groupId>jboss.jms-integration-tests</groupId>
    <artifactId>integration-mdb20-durable</artifactId>
    <version>1.0.1.GA</version>
  </dependency>
  <dependency>
    <groupId>jboss.jms-integration-tests</groupId>
    <artifactId>integration-mdb20-selector</artifactId>
    <version>1.0.1.GA</version>
  </dependency>
  <dependency>
    <groupId>jboss.jms-integration-tests</groupId>
    <artifactId>integration-mdb20-userTransaction</artifactId>
    <version>1.0.1.GA</version>
  </dependency>
  <dependency>
    <groupId>jboss.jms-integration-tests</groupId>
    <artifactId>integration-mdb20-userTransactionDups</artifactId>
    <version>1.0.1.GA</version>
  </dependency>
  <dependency>
    <groupId>jboss.jms-integration-tests</groupId>
    <artifactId>jms-integration-tests</artifactId>
    <version>1.0.1.GA</version>
  </dependency>
Run Code Online (Sandbox Code Playgroud)

我不知道这些依赖项来自哪里,或者它们是否相关。最奇怪的是,就像我说的,当我手动构建时,构建工作正常。然而,这意味着我不能使用一些像 WTP 集成这样的 m2eclipse 特性。

有什么建议?

Bre*_*den 1

要查找依赖项的来源,请在 m2eclipse 的 Maven POM 编辑器中打开您的 pom。“依赖关系层次结构”选项卡的右侧是已解析的依赖关系列表。这与 effective-pom 依赖项列表同义。选择右侧的任何依赖项,该依赖项的来源将显示在左侧。