You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Nicolas De Loof <ni...@capgemini.com> on 2005/10/21 09:07:26 UTC

How to share JSPs between 2 wars projects ?

Hi all,

I've got a packaging problem : my webapp requires to be "customized" for 
the target servers
-> change web.xml, add some xml (spring) configuration files, add some 
target-server-specific classes

All other things in my webapp are commons.

I'd like maven to build the 3 wars (I've got 3 target servers), so I've 
setup multiproject like this:
- commons classes -> app.jar
- base-webapp (JSP, images, script + default config...) -> base.war
- serverN-webapp (server N specific web.xml + some conf + specific JSP) 
-> serverN.war

It's easy to make the classes commons using a jar project dependency, 
but what about JSP or static web files ?

Using maven 1, I've setup a maven.xml script that unwar the base.war 
into target/artifactId as a pregoal to "war:war-resources". This seems 
to work fine :

<preGoal name="war:war-resources">
    <j:set var="war.build"
        
value="${pom.getPluginContext('maven-war-plugin').getVariable('maven.war.webapp.dir')}"/>
    <unwar overwrite="true"
        src="${pom.getDependencyPath('gta:gta-web')}"
        dest="${war.build}"/>
  </preGoal>


Using maven 2, I could use antRun and use the "unwar" task, but I don't 
know how to configure it to run prior to maven2 equivalent for 
war:war-resources. Is there any more "maven 2"-way to do such a thing ?

It may be usefull also to have a way to "merge" two webapps, for example 
to develop a Struts-webapp as sub-projects (quick to deploy and test) 
and merge struts-modules into a big war.

Nico.

This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient,  you are not authorized to read, print, retain, copy, disseminate,  distribute, or use this message or any part thereof. If you receive this  message in error, please notify the sender immediately and delete all  copies of this message.


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