tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephen Davidson" <>
Subject RE: different versions of jars within EAR/WAR/EJB module
Date Sun, 21 Feb 2010 18:19:05 GMT
Oh yeah, good point.

The "nasty" way: mvn dependency:tree
The better way (works ONLY if you are using eclipse):
Install m2eclipse plugin into Eclipse, the re-import your project using
that plugin.  When you open the pom, one of the available tabs will give
you a jar & dependency list.


-----Original Message-----
From: Karsten Ohme [] 
Sent: Sunday, February 21, 2010 12:16 PM
Subject: Re: different versions of jars within EAR/WAR/EJB module

Hi Stephen,

but how have you found out, which libraries are used by sub libraries
and solved this?

E:g I have Foo.jar using commons-lang-2.3 and Bar.jar commons-lang-2.4.
Now I only want to have one one the commons-lang. One way is to strip
away the version so an already used one is overwritten, but I'm not sure
if this always works if the API has changed.

Maybe there is some version aware class loader out there which can load
from class information the right one.

Am 21.02.2010 18:36, schrieb Stephen Davidson:
> Hi Karsten.
> I had this problem as well, especially my project uses multiple wars.
> researched "skinny wars", and found a solution.  In a nutshell, you
> jars & wars declare all shared dependencies (such as commons-logging,
> whatever third-party library has this as its dependency) with scope
> "provided".  You can do this by default be declaring your shared
> dependencies at the parent pom level.
> Then, in the EAR's pom, I redeclared the dependency, without the
> "provided" scope.  The only annoying thing was when I had to
> automatically provide some jars on a EAR wide level.  I had to add the
> following section;
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-ear-plugin</artifactId>
> <!-- configuring the ear plugin -->
> <configuration>
> <!-- (one for each jar to had to have its classes automatically
> available, dependency MUST be explicitly declared in the pom's
> dependency section) -->
>   <jarModule>
>     <groupId>groupId</groupId>
>     <artifactId>shared</artifactId>
>     <bundleDir>lib</bundleDir>
>   </jarModule>
> </configuration>
> <plugin>
> Regards,
> Steve
> -----Original Message-----
> From: Karsten Ohme [] 
> Sent: Sunday, February 21, 2010 11:16 AM
> To:
> Subject: different versions of jars within EAR/WAR/EJB module
> Hi,
> I have the following problem:
> I'm using different utility libraries which are using also different 
> versions of e.g. Apache-commons libraries. Now some libraries are used
> in different versions. So, I have possibly some default library
> in the application server and some library versions in my ear and the
> ear can also include different library versions.
> Which library wins? Until now somehow this always worked, but now I
> the problem with different versions. I received strange exceptions
> using different versions together.
> How can this problem be solved? Do I have to exclude in my Maven
> configuration all duplicates manually?
> Regards,
> Karsten

Karsten Ohme
T-Systems Multimedia Solutions GmbH
Portal Technologies, Applications & Appliances
Hausanschrift: Riesaer Strasse 5, 01129 Dresden
Postanschrift: Postfach 10 02 24, 01072 Dresden
Telefon: +49 351 28 20 - 2123
Fax: +49 171 351 28 20 - 5116

View raw message