You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Edward Yakop <ed...@tokuii.com> on 2005/09/01 14:22:46 UTC

[m2] ear task problem/bug?

Maven version: 2.0-beta-1-SNAPSHOT  svn revision: 265679

Hi,

 
I am attempting to migrate an ear project from ant style to m2 project 
style.

In the high level project dependencies:

[ear] -depends-> [war]
  |
  |----depends-> [ejb] -depends-> [persistence]
                                      |
                                      |----depends-> [spring lib], 
[hibernate lib], etcs


--------------
pom.xml of ear
--------------
<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.tokuii.serverside.baseapp.ear</groupId>
  <artifactId>ear</artifactId>
  <version>1.0-SNAPSHOT</version>
  <name>Baseapp - EAR</name>
  <packaging>ear</packaging>
  <dependencies>
    <dependency>
      <groupId>com.tokuii.serverside.baseapp.flash</groupId>
      <artifactId>war</artifactId>
      <version>1.0-SNAPSHOT</version>
      <type>war</type>
    </dependency>
    <dependency>
      <groupId>com.tokuii.serverside.baseapp.flash</groupId>
      <artifactId>ejb</artifactId>
      <version>1.0-SNAPSHOT</version>
      <type>ejb</type>
    </dependency>
  </dependencies>
</project>
--------------

--------------
pom.xml of war
--------------
<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.tokuii.serverside.baseapp.flash</groupId>
  <artifactId>war</artifactId>
  <version>1.0-SNAPSHOT</version>
  <name>Baseapp - WAR</name>
  <packaging>war</packaging>
  <dependencies>
    <dependency>
      <groupId>servletapi</groupId>
      <artifactId>servletapi</artifactId>
      <version>2.3</version>
      <scope>provided</scope>
    </dependency>
  </dependencies>
</project>
--------------

--------------
pom.xml of ejb
--------------
<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.tokuii.serverside.baseapp.flash</groupId>
  <artifactId>ejb</artifactId>
  <version>1.0-SNAPSHOT</version>
  <name>Baseapp - ejb</name>
  <packaging>ejb</packaging>
  <dependencies>
    <dependency>
      <groupId>com.tokuii.serverside.baseapp</groupId>
      <artifactId>persistence</artifactId>
      <version>1.0-SNAPSHOT</version>
    </dependency>
    <dependency>
      <groupId>jboss</groupId>
      <artifactId>jboss-j2ee</artifactId>
      <version>3.2.3</version>
      <scope>provided</scope>
    </dependency>
  </dependencies>
</project>

----------------------
pom.xml of persistence
----------------------
<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.tokuii.serverside.baseapp</groupId>
  <artifactId>persistence</artifactId>
  <version>1.0-SNAPSHOT</version>
  <name>Baseapp - persistence</name>
  <packaging>jar</packaging>
  <dependencies>
    <dependency>
      <groupId>springframework</groupId>
      <artifactId>spring</artifactId>
      <version>1.2.4</version>
    </dependency>
    <dependency>
      <groupId>hibernate</groupId>
      <artifactId>hibernate</artifactId>
      <version>2.1.8</version>
    </dependency>
  </dependencies>
</project>

Questions:

1 How do I execute m2 to embed all the dependent artifacts into the ear 
and update the MANIFEST.MF of ejb project class path that the libraries 
are inside .ear file?

2 Is this a bug?

----------------------------- 
The generated application.xml
-----------------------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE application PUBLIC
    "-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN"
    "http://java.sun.com/dtd/application_1_3.dtd">
<application>
  <display-name>ear</display-name>
  <module>
    <ejb>ejb-1.0-SNAPSHOT.jar</ejb>
  </module>
  <module>
    <web>
      <web-uri>war-1.0-SNAPSHOT.war</web-uri>
      <context-root>/war</context-root>
    </web>
  </module>
  <module>
    <java>hibernate-2.1.8.jar</java>
  </module>
  <module>
    <java>spring-1.2.4.jar</java>
  </module>
  <module>
    <java>persistence-1.0-SNAPSHOT.jar</java>
  </module>
</application>
------------------------------
  Q: 2.1 Why would the dependency all the dependency of persistence is 
included as "ejb-client" of ejb? None of hibernate, spring, persistence 
should be included inside application.xml?

     2.2 How do I make the <context-root>/war</context-root> to be any 
other name without modifying the artifactId?

and The ear file contains:
------------------------------
ejb-1.0-SNAPSHOT.jar
war-1.0-SNAPSHOT.war
hibernate-2.1.8.jar
spring-1.2.4.jar
...
------------------------------

     2.3 Shouldn't all dependent libraries of hibernate and spring to be 
included inside ear? If no, how do I configure ear/ejb task to do so?

     2.4 According to 
http://java.sun.com/j2ee/verified/packaging.html#checking end of 
paragraph. I should be able to configure the classpath inside 
ejb.jar/META-INF/MANIFEST.MF file. For example:

---------------------
META-INF/MANIFEST.MF:
---------------------
   Manifest-Version: 1.0
   Class-Path: spring-1.2.4.jar hibernate-2.1.8.jar ...
   Created-By: 1.4.2_05-b04 (Sun Microsystems Inc.)
-------

     3 How do I setup the existing ejb pom.xml in order for maven to 
generate "Class-Path" for all transitive dependency libraries?

Note: hibernate-2.1.6.pom, hibernate-2.1.7c.pom, hibernate-3.0.1.pom, 
hibernate-3.0.3.pom, hibernate-3.0.pom, and hibernate-2.1.8.pom is 
definitely broken:

This is 2.1.4:
----------------
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>hibernate</groupId>
<artifactId>hibernate</artifactId>
<version>2.1.4</version>
<dependencies>
<dependency>
<artifactId>commons-lang</artifactId>
<groupId>commons-lang</groupId>
<version>1.0.1</version>
</dependency>
<dependency>
<artifactId>dom4j</artifactId>
<groupId>dom4j</groupId>
<version>1.4</version>
</dependency>
<dependency>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
<version>1.0.3</version>
</dependency>
<dependency>
<artifactId>commons-beanutils</artifactId>
<groupId>commons-beanutils</groupId>
<version>1.6</version>
</dependency>
<dependency>
<artifactId>commons-collections</artifactId>
<groupId>commons-collections</groupId>
<version>3.0</version>
</dependency>
<dependency>
<artifactId>cglib-full</artifactId>
<groupId>cglib</groupId>
<version>2.0.1</version>
</dependency>
<dependency>
<artifactId>bcel</artifactId>
<groupId>bcel</groupId>
<version>5.0</version>
</dependency>
<dependency>
<artifactId>log4j</artifactId>
<groupId>log4j</groupId>
<version>1.2.8</version>
</dependency>
<dependency>
<groupId>geronimo-spec</groupId>
<artifactId>geronimo-spec-jta</artifactId>
<version>DEV</version>
</dependency>
<dependency>
<groupId>odmg</groupId>
<artifactId>odmg</artifactId>
<version>3.0</version>
</dependency>
</dependencies>
</project>
----------------

and this is 2.1.8:
------------------
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>hibernate</groupId>
<artifactId>hibernate</artifactId>
<version>2.1.8</version>
</project>
------------------

Regards,
Edward


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org