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

发布于 2024-10-24 18:02:05 字数 2623 浏览 4 评论 0原文

我在使用 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

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

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

Unknown artifact type[test-jar]

我在论坛中读到,这可能是由缺少“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>

我不知道这些依赖项来自哪里,也不知道它们是否相关。 最奇怪的是,就像我说的,当我手动进行构建时,构建效果很好。 但是,这意味着我无法使用一些 m2eclipse 功能,例如 WTP 集成。

有什么建议吗?

I am having trouble building an EJB EAR with Maven in Eclipse 3.6 with the m2eclipse project builder. Curiously, a manual build (either on the command line or with "Run as -> Maven build") works fine. I have set up Eclipse to use an external Maven 2.2.1 installation.

The error message is as follows:

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

So apparently generation of the application.xml descriptor fails for some reason I could not yet determine.

In the error log view I have the following message:

Unknown artifact type[test-jar]

I have read in a forum that might be caused by a "test-jar" dependency that is missing "test" scope; however, I have double- and triple-checked for this and can't find any unscoped "test-jar" dependencies in my pom.xml files.

I've found the following entries with mvn help:effective-pom though:

  <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>

I have no idea where those dependencies come from or if they are relevant at all.
The most curious thing is that, like I said, building works fine when I do it manually.
However, this means that I can't use some m2eclipse features like WTP integration.

Any suggestions?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦里兽 2024-10-31 18:02:05

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

To find where dependencies come from, open your pom in m2eclipse's Maven POM editor. On the right hand side of the 'Dependency Hierarchy' tab, is the resolved dependency list. This is synonymous with the effective-pom dependency listing. Select any dependency on the right and where that dependencies comes from will be revealed on the left.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文