Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven 2.2.1 fails to build EAR project with m2eclipse

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?

like image 572
chris Avatar asked Nov 14 '22 01:11

chris


1 Answers

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.

like image 147
Brent Worden Avatar answered Dec 16 '22 21:12

Brent Worden