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

标签 java eclipse maven m2eclipse ear

我在使用 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 描述符的生成由于某种我无法确定的原因而失败。

在错误日志 View 中,我有以下消息:

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 集成。

有什么建议吗?

最佳答案

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

关于java - Maven 2.2.1 无法使用 m2eclipse 构建 EAR 项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5380221/

相关文章:

java - Spring事务注解回滚测试好像不太顺利

android - 尽管没有错误,但无法在 Eclipse 中运行 Android 项目

eclipse - DBeaver 内容辅助颜色

java - 从弹出窗口复制 eclipse 中的变量值的任何插件或快捷方式?

java - 所需库的存档 : 'lib/Chrome/chromedriver' in project 'XYZ' cannot be read or is not a valid ZIP file using ChromeDriver Selenium Java

java - 为什么我们在 Wildfly 中需要以下用于 EJB 3.2 的 jboss jar?

java - 命令行参数中的转义序列 (Java)

java - Spring MVC - 竞争条件?

java - 在 Activity 之间传递变量值

java 策略错误小程序警报