You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "Veerman, Christiaan" <cv...@knowledgestorm.com> on 2006/05/02 22:49:57 UTC

RE: M2 - Best practice for common jars between EJB,WAR modules in EAR

Hello:

I believe my problems is tightly coupled with the previous thread.

My JBOSS EAR has all the dependent jars in the root; I would like to
share those jars with the WAR, EJB, etc...

This works in weblogic; as it shares resources through the EAR's
APP-INF/lib without any need to add it to the MANIFEST.

So now I'm now using Jboss 4.0.3 sp1 which doesn't support shared
resources from the EAR like Weblogic; although I read it will be a
feature of JEE 5 :D
 
I would like my the maven-war-plugin to add the <scope>provided</scope>
dependencies to the Class-Path in MANIFEST.MF and NOT copy them to the
WEB-INF/lib directory.  When I change the <scope> to compile, runtime
appropriately; the plugin will create Class-Path; however it will add
the dependencies to WEB-INF/lib.




Your help would be greatly appreciated.


Cheers,

Christiaan


-----Original Message-----
From: Brad O'Hearne [mailto:brado@neurofire.com] 
Sent: Wednesday, March 22, 2006 1:47 PM
To: Maven Users List
Subject: Re: M2 - Best practice for common jars between EJB,WAR modules
in EAR

Richard,

I feel your pain. I struggled with similar issues at great length
several weeks back. On one hand, Maven's encouragement toward modularity
is a good thing, but something that comes with that is that in handling
upstream dependencies, there is no consideration given to the downstream
archive being built. So on one hand, there's the argument that a WAR
should be a self-contained archive, which is a good argument; but
pragmatically, doing so may result in huge EAR files. Additionally,
manipulating jar classpaths and the like doesn't really help much,
because you need upstream manipulation of these, not just the EAR you
are building. Add JBoss SARs and WSRs into the mix, and the whole deal
gets really fun.

I am sure there are some maven experts here that can give you better
advice than I on pursuing a solution. While it doesn't optimize file
size, the way it works now, keeping everything self-contained and
modular isn't a wrong approach -- you just probably won't like the size
of your EAR file. One possible approach might be to alter the WAR plugin
to allow inclusion or exclusion of dependencies, and treat things the
way the JAR plugin works. Another approach might be to fork the EAR
plugin and create a new plugin that will both create your WAR and EAR in
the same project. Just thoughts, maybe not good ones, but ideas.

In the end, I concluded that the time investment to get it to optimize
dependency packaging wasn't worth it, and that the nuisance of file size
could be incurred. If you hit on a solution, let me know.

Brad


On Mar 22, 2006, at 11:23 AM, Wayne Fay wrote:

> I've been wondering this myself and just "didn't care" enough to 
> really solve the "problem". ;-)
>
> Fortunately the duplicated libs are not very large so it doesn't 
> affect me much (yet).
>
> Anyone got a solution?
>
> Wayne
>
>
> On 3/22/06, Richard Sladek <ri...@abilitydev.com> wrote:
>>
>> Hello,
>> I've been searching through the archive half of the day but I haven't

>> found a satisfactory solution to my problem:
>> I have an EAR including 2 modules: EJB JAR and WAR.
>> These 2 modules have some common dependencies, lets say 
>> mycommonlib.jar.
>>
>> When I run the packaging on EAR, I get duplicates of mycommonlib.jar:
>> one is in EAR's root, the other is in WAR's WEB-INF/lib.
>>
>> I found a way how to exclude this from WEB-INF/lib by providing:
>>     <plugin>
>>        <groupId>org.apache.maven.plugins</groupId>
>>        <artifactId>maven-war-plugin</artifactId>
>>        <configuration>
>>          <warSourceExcludes>WEB-INF/lib/*.jar</warSourceExcludes>
>>          <archive>
>>            <manifest>
>>              <addClasspath>true</addClasspath>
>>              <classpathPrefix>/</classpathPrefix>
>>            </manifest>
>>          </archive>
>>        </configuration>
>>      </plugin>
>> in my WAR's pom.xml
>>
>> However, now none of my WAR's dependencies gets resolved to the EAR 
>> (see http://jira.codehaus.org/browse/MEAR-14), even those that are 
>> not common.
>> Is there a way how could I force EAR plugin to enable transitive 
>> dependencies on a WAR?
>>
>> Also see
>> http://jira.codehaus.org/browse/MWAR-9
>> --
>> View this message in context: http://www.nabble.com/M2---Best-
>> practice-for-common-jars-between-EJB%2CWAR-modules-in-EAR-
>> t1325601.html#a3537700
>> Sent from the Maven - Users forum at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>


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

****DISCLAIMER
The information contained in this e-mail and attachments, if any, is confidential and may be subject to legal privilege.  If you are not the intended recipient, you must not use, copy, distribute or disclose the e-mail and its attachment, or any part of its content or take any action in reliance of it.  If you have received this e-mail in error, please e-mail the message back to the sender by replying and then deleting it.  We cannot accept responsibility for loss or damage arising from the use of this e-mail or attachments, and recommend that you subject these to your virus checking procedures prior to use

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


Re: M2 - Best practice for common jars between EJB,WAR modules in EAR

Posted by Lee Meador <le...@leemeador.com>.
I've got two ejb jars, a few wars and they are all in an ear.

I'm using Webshere 6.

I do the same thing you do but exclude the jars from the wars. There used to
be a bug where you could exclude everything from the war or nothing. Maybe
that is fixed and you can exclude piecemeal. I got by by excluding
everything and then doing something ugly with the one unique 3rd party jar
that I only needed in one war and no ejb jars. I just added it into one of
the ejb jars. The ejb code didn't need it but the classloader order made it
available to the war.

On 5/3/06, Gwyn <gw...@gmail.com> wrote:
>
>
> I'm not sure if this works in JBoss, but the way I'm doing it in Weblogic
> is
> slightly different, so might be worth trying just on the off chance...
>
> I've got an EAR, which contains an EJB jar, a number of WARs and a number
> of
> common jars, all in the root.  The common jars are referenced in the EJB's
> MANIFEST as a result of the following...
>
>                <groupId>org.apache.maven.plugins</groupId>
>                 <artifactId>maven-ejb-plugin</artifactId>
>                 <configuration>
>                     <archive>
>                         <manifest>
>                             <addClasspath>true</addClasspath>
>                         </manifest>
>                     </archive>
>                 </configuration>
>
> --
> View this message in context:
> http://www.nabble.com/RE%3A-M2---Best-practice-for-common-jars-between-EJB%2CWAR-modules-in-EAR-t1545876.html#a4211266
> Sent from the Maven - Users forum at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


--
-- Lee Meador
Sent from gmail. My real email address is lee@leemeador.com

RE: M2 - Best practice for common jars between EJB,WAR modules in EAR

Posted by Gwyn <gw...@gmail.com>.
I'm not sure if this works in JBoss, but the way I'm doing it in Weblogic is
slightly different, so might be worth trying just on the off chance...

I've got an EAR, which contains an EJB jar, a number of WARs and a number of
common jars, all in the root.  The common jars are referenced in the EJB's
MANIFEST as a result of the following...

               <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-ejb-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifest>
                            <addClasspath>true</addClasspath>
                        </manifest>
                    </archive>
                </configuration>

--
View this message in context: http://www.nabble.com/RE%3A-M2---Best-practice-for-common-jars-between-EJB%2CWAR-modules-in-EAR-t1545876.html#a4211266
Sent from the Maven - Users forum at Nabble.com.


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