If your client is itself an EAR, one solution, albeit ugly is to
explicitly exclude those jars from the client-side EAR...

In the client-side EAR's POM...

  ...
  <build>
    <plugins>
      <plugin>
        <artifactId>maven-ear-plugin</artifactId>
        <configuration>
          <modules>
            <javaModule>
              <groupId>my-db-lib</groupId>
              <artifactId>my-db-lib</artifactId>
              <excluded>true</excluded>
            </javaModule>
                ...
          </modules>
        </configuration>
      </plugin>
    </plugins>
  </build>
  ...

There are similar ways to explicitly exclude artifacts from other forms
of packaging.  The downside is that each client has to explicitly
exclude the jar(s) making this an ugly approach (or conversely,
explicitly include only what is wanted).  I'd love to hear about a
better solution if anyone knows of one.


-Daryl


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 24, 2006 4:45 AM
To: users@maven.apache.org
Subject: ejb-client and transitive dependencies

Hi,

I habe a problem with transitive dependencies when a project depends on
a ejb artifact (ejb-client). My system consists of a client application
(i.e. a rich client) which uses a ejb server application. The ejb server
application needs some other artifacts for the server side processing
(i.e. a DB access library). The client needs nothing else than the
client-jar of the ejb artifact. My project structure with some pom.xml
snippets looks as follows:

myclient
 <artifactId>myclient</artifactId>
 <dependencies>
  <dependency>
   <artifactId>myserver-ejb</artifactId>
   <type>ejb-client</type>
  </dependency>
 </dependencies>
 
myserver
 myserver-ear
  <artifactId>pv-ear</artifactId>
  <packaging>ear</packaging>
 myserver-ejb
  <artifactId>myserver-ejb</artifactId>
  <packaging>ejb</packaging>
  <dependencies>
   <dependency>
    <artifactId>my-db-lib</artifactId>
   </dependency>
  </dependencies>

It works almos fine. My problem is that the the client application
(myclient) does not only inherit the ejb-client-jar of the server
project. 
It inherits also the dependencies which are only used for server side
processing (my-db-lib). Is there a way to suppress this dependeny
inheritation (i.e. by setting a special scope on the my-db-lib
dependency)?

Setting the scope of the "my-db-lib" dependency to "provided" did not
work because the dependency was also excluded from the generated ear
file. 

The only way, i got it to work was by adding a exclusion to the client's
pom.xml:
<artifactId>myclient</artifactId>
<dependency>
 <artifactId>myserver-ejb</artifactId>
 <type>ejb-client</type>
  <exclusions>
   <exclusion>
     <artifactId>my-db-lib</artifactId>
   </exclusion>
 </exclusions>
</dependency>
 
I don't like this solution because i have to change the client's pom
every time i add a internal library to the server project. Isn't there
another solution for controlling the exported dependencies of a ejb
artifact?

Thanks for your help.

Regards, Matthias

--
Matthias Germann
DV Bern AG

mailto:[EMAIL PROTECTED]
http://www.dvbern.ch

Postadresse: Nussbaumstrasse 21, Postfach 106, 3000 Bern 22
Direktwahl: +41 31 378 24 60
Telefonzentrale: +41 31 378 24 24, Telefax: +41 31 378 24 74

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to