maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dennis Lundberg <denn...@apache.org>
Subject Re: War overlay trouble for Pom that produces WAR and JAR
Date Sat, 12 Jun 2010 09:51:38 GMT
On 2010-06-11 19:27, Starrman wrote:
> 
> Hello Jesse...
> 
> I agree with your principle of doing things the "maven way" and  
> Maven's principle of "convention over configuration".
> 
> I actually am using common code in both projects... This was the  
> project that I referred to as the "myOverlayWebapp.war" project... I  
> am trying to use war overlays for the common web components and the  
> common classes.
> 
> Do you see a reason why Syed's suggestion wouldn't work?

It can work, but there are some issues in the WAR Plugin that could
potentially cause problems for you.

> Perhaps I have misunderstood your post and you are sugesting that I do  
> not try to keep the classes in the overlay project but instead place  
> them in a 4th project (separate from the shared webapp artifacts  
> within the overlay WAR). I would hope that I could keep all shared  
> files in the overlay webapp...

In my experience it is far easier to get things to work well if you
separate them properly. If I understand your description correctly, my
advice is to have the following projects:

1. myOverlay (packaging=war)
2. myCommon (packaging=jar)
3. myapp1 (packaging=war), depends upon myOverlay
4. myapp2 (packaging=war), depends upon myCommon

After that you can have other projects use the common classes in
myCommon, and yet other projects use the overlay myOverlay. If some
project wants to use both - just add both as dependencies.

> On Jun 11, 2010, at 11:27 AM, "Jesse Farinacci [via Maven]" <ml-node+329413-167754338-23151@n5.nabble.com

>  > wrote:
> 
>> Hi Starrman,
>>
>> On Fri, Jun 11, 2010 at 11:03 AM, Starrman <[hidden email]> wrote:
>>>
>>> Do you have any ideas how I could depend upon the classes during  
>> the compile
>>> yet not pull in the web artifacts into myapp2?
>>>
>>
>> You're having problems because you aren't doing things The Maven Way.
>> Just refactor your project such that the common code bits are in some
>> new shared module that you create. Then have the myapp1 and myapp2
>> depend on the shared module.
>>
>> You might not like this solution because it lends towards module
>> explosion (to the benefit of decreasing build complexity), but you've
>> probably already wasted more time trying to hack through the system
>> than just working with it...
>>
>> The Japanese have a great expression which basically says: the nail
>> that sticks out gets hammered. :-)
>>
>> -Jesse
>>
>> -- 
>> There are 10 types of people in this world, those
>> that can read binary and those that can not.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>
>>
>> View message @ http://maven.40175.n5.nabble.com/War-overlay-trouble-for-Pom-that-produces-WAR-and-JAR-tp329411p329413.html
>> To unsubscribe from War overlay trouble for Pom that produces WAR  
>> and JAR, click here.
>>
> 


-- 
Dennis Lundberg

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


Mime
View raw message