You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by smallufo <sm...@gmail.com> on 2010/03/13 07:35:03 UTC

Combining modules' jars into one war ?

Hi
I am new to Maven , I have a problem about splitting a project into modules
and combining them into WAR.

I first build a parent project , naming 'destiny' with a POM (packaging
'pom') , and create 3 modules (sub-projects) :

1st is destiny-core (packaging : jar) : pure POJOs
2nd is destiny-webapp-servlets (packaging : jar) : pure servlets , only
depends on javax.servlet , and core
3rd is destiny-wicket (packaging : jar) : wicket apps , depends on
apache-wicket , and core

The servlets and wicket both share the same web.xml , so I put the web.xml
in src/main/webapp/WEB-INF/web.xml

I tried to execute maven war:war  in the 'destiny' dir , but Maven
complained it cannot find web.xml inside destiny-core .
Then I executed maven package , and got three jars : destiny-core.jar ,
destiny-webapp-servlets.jar , destiny-wicket.jar. This is not what I want
...
I need the three modules combined into one war , how to accomplish it ?
Thanks in advanced...

Re: Combining modules' jars into one war ?

Posted by Ron Wheeler <rw...@artifact-software.com>.
smallufo wrote:
> Wow , it works !
> But I have another question :
> What if these modules share the same config files , such as log4j.properties
> , or ehcache.xml  , or spring's context.xml ?
> Should I split one config file into different parts and put into
> corresponding module ? (and if true , how to combine the parts into one ?)
> Or what's the better way to manage these config files , so that each module
> can locate it , and test separately it with problems ?
> Thanks in advanced.
>   
There always has to be an element of common sense
In my view, if the config file describes your application, it probably 
belongs at the top level (application)
If you put them in the lower levels, it may be harder for someone doing 
maintenance to figure out where something is being set.

Ron
>
> 2010/3/13 Wayne Fay <wa...@gmail.com>
>
>   
>>> I need the three modules combined into one war , how to accomplish it ?
>>> Thanks in advanced...
>>>       
>> Make a fourth project with "war" packaging, and depend on the other 3
>> projects, then run "mvn package" from the top/parent directory and
>> eventually it will result in a war in the target folder of that 4th
>> project.
>>
>> Wayne
>>
>> ---------------------------------------------------------------------
>> 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


Re: Combining modules' jars into one war ?

Posted by Justin Edelson <ju...@gmail.com>.
I don't think there is a general-purpose solution to the config
combination problem. In some cases (log4j.properties, possibly
ehcache.xml), the config file is, for the purpose of the jar modules, a
test concern and thus can go in src/test/resources. BoxSpring
(www.boxspring.org) is one way of solving this problem for Spring
configuration files, i.e. tweaking Spring to support combining
configuration.

Justin

On 3/13/10 8:29 PM, smallufo wrote:
> Wow , it works !
> But I have another question :
> What if these modules share the same config files , such as log4j.properties
> , or ehcache.xml  , or spring's context.xml ?
> Should I split one config file into different parts and put into
> corresponding module ? (and if true , how to combine the parts into one ?)
> Or what's the better way to manage these config files , so that each module
> can locate it , and test separately it with problems ?
> Thanks in advanced.
> 
> 
> 2010/3/13 Wayne Fay <wa...@gmail.com>
> 
>>> I need the three modules combined into one war , how to accomplish it ?
>>> Thanks in advanced...
>>
>> Make a fourth project with "war" packaging, and depend on the other 3
>> projects, then run "mvn package" from the top/parent directory and
>> eventually it will result in a war in the target folder of that 4th
>> project.
>>
>> Wayne
>>
>> ---------------------------------------------------------------------
>> 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


Re: Combining modules' jars into one war ?

Posted by smallufo <sm...@gmail.com>.
Wow , it works !
But I have another question :
What if these modules share the same config files , such as log4j.properties
, or ehcache.xml  , or spring's context.xml ?
Should I split one config file into different parts and put into
corresponding module ? (and if true , how to combine the parts into one ?)
Or what's the better way to manage these config files , so that each module
can locate it , and test separately it with problems ?
Thanks in advanced.


2010/3/13 Wayne Fay <wa...@gmail.com>

> > I need the three modules combined into one war , how to accomplish it ?
> > Thanks in advanced...
>
> Make a fourth project with "war" packaging, and depend on the other 3
> projects, then run "mvn package" from the top/parent directory and
> eventually it will result in a war in the target folder of that 4th
> project.
>
> Wayne
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Combining modules' jars into one war ?

Posted by Wayne Fay <wa...@gmail.com>.
> I need the three modules combined into one war , how to accomplish it ?
> Thanks in advanced...

Make a fourth project with "war" packaging, and depend on the other 3
projects, then run "mvn package" from the top/parent directory and
eventually it will result in a war in the target folder of that 4th
project.

Wayne

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