Actually, I just noticed that support for merging dependent WARs with a WAR project has been added to the latest version of the maven-war-plugin (see http://jira.codehaus.org/browse/MNG-1507). You will have to check Maven 2 (or at least the maven-war-plugin) out from Subversion and build it yourself to get this functionality. Then you just reference your common WAR project from another WAR project as a dependency of <type>war</type> and it will automatically be merged.

However, I would like to see the maven-war-plugin support the web.xml merge functionality that Kevin Galligan's hack includes. Maybe you can raise this as a JIRA issue Kevin?

Richard Allen


Richard Allen wrote:

A solution may be to put your common WAR code in a separate project, have your other WAR projects call out the common war project as a dependency, and then use the maven-war-plugin hack posted by Kevin Galligan (see http://www.nabble.com/-M2-war-project-using-war-type-dependencies-t473430.html#a1352624) to merge the common WAR project with your other WAR projects.

Richard Allen

Michael McCrann wrote:

Hi,

I am trying to create an application that is made up of a number of war files that are almost identical. Each war differs only by resource descriptors (web.xml, etc) and a few images.

Can I do this using a multi-module project as shown below:

Project (pom.xml)
|
|---ear module (pom.xml)
|
|---parent of web modules (has common source code, JSP, CSS, images etc.)
   |
   |--- web module A (war)
   |--- web module B (war)
   |--- web module C (war)

The parent web module has common things - source code, JSPs, images, CSS, Javascript, etc. Then the individual modules just have the things that are different for them, and they build using the parent's common things plus their individual things.

Michael
-----Original Message-----
From: Richard Allen [mailto:[EMAIL PROTECTED] Sent: Wednesday, 30 November 2005 11:42 AM
To: Maven Users List
Subject: Re: RE : War phases, binding a custom plugin to the war creation

I'm definitely interested in this. We use Struts modules and we keep each Struts module in a separate project. We have to merge the various Struts modules during the build process (which are each like a WAR). I'm currently using a maven-war-plugin hack that a previous user posted to the list (may have been you Kevin), but I would like to see something more standard in place, especially since this seems to be a common use case.

Thanks,
Richard Allen


Kevin Galligan wrote:

I've hacked up the maven-war-plugin to merge war dependencies into the final product. I posted the code originally, but I've added a few things since then. These include an updated version of the cargo web.xml merging code. The current version only merges certain parts of the web.xml. Internally we needed more.

I also track the war file version to we don't need a full extract of dependent wars every time a build is done. The way I do this is very hacky, but functional.

Anyway, wondering if anybody would be interested, and/or if this kind of functionality would be considered for a future add.

Olivier Lamy wrote:

Hi,
I'm happy to see that some users needs more feature in the maven-war-plugin !! It works but for simple webapp and you need to add some embedeed ant scripts in order to copy some files (it's really clean). I have provided a patch http://jira.codehaus.org/browse/MNG-1683 which add some features.
Take this
http://jira.codehaus.org/secure/attachment/17799/maven-war-plugin.tar
.gz

- Unzip it - install the plugin : mvn -DupdateReleaseInfo=true clean >> install
- look at the documentation : mvn site

Exemple :
To add jsp files add this in the configuration :
       <webappDirectory
implementation="java.io.File">${basedir}/webappdir</webappDirectory>
         <resources>
           <resource>
             <directory>${basedir}/src/main/jsp</directory>

             <targetPath>${basedir}/webappdir</targetPath>
<!-- note ${webappDirectory} doesn't work due to some introspection trouble I have updated my local version to copy resources to a target path relative to ${webappDirectory}
        -->
           </resource>
                   </resources>

I don't really know if this kind of features will be added one day in the maven-war-plugin.... (because in some contexts create a war is more complicated than the jobs provided by the default plugin)

Note the issue http://jira.codehaus.org/browse/MNG-791 (mark as fixed in 2.0.1).

HTH,

- Olivier

-----Message d'origine-----
De : Bruno Aranda [mailto:[EMAIL PROTECTED] Envoyé : mardi 29 novembre 2005 18:46 À : Maven Users List Objet : War phases, binding >> a custom plugin to the war creation


Hi all,

I would like to know what phase I have to use to bind a plugin to the war creation (war:war).

<plugin>
    <groupId>my.groupId</groupId>
    <artifactId>maven-myPlugin-plugin</artifactId>
    <executions>
      <execution>
        <phase>WHAT TO PUT HERE</phase>
        <goals>
          <goal>myPluginGoal</goal>
        </goals>
      </execution>
    </executions>
  </plugin>

It works ok for the process-resources and package phases, but the first is too early, and the other is too late. I am trying to copy some JSP pages in a specific way to the exploded war folder before creating the war file,

TIA,

Bruno

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



This e-mail, any attachments and the information contained therein ("this message") are confidential and intended solely for the use of the addressee(s). If you have received this message in error please send it back to the sender and delete it. Unauthorized publication, use, dissemination or disclosure of this message, either in whole or in part is strictly prohibited.
*********************************************************************
* Ce message électronique et tous les fichiers joints ainsi que les >> informations contenues dans ce message ( ci après "le message" ), sont confidentiels et destinés exclusivement à l'usage de la personne à laquelle ils sont adressés. Si vous avez reçu ce message par erreur, merci de le renvoyer à son émetteur et de le détruire. Toutes diffusion, publication, totale ou partielle ou divulgation sous quelque forme que se soit non expressément autorisées de ce message, sont interdites.
*********************************************************************
*

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



NOTICE
This e-mail and any attachments are confidential and may contain copyright material of Macquarie Bank or third parties. If you are not the intended recipient of this email you should not read, print, re-transmit, store or act in reliance on this e-mail or any attachments, and should destroy all copies of them. Macquarie Bank does not guarantee the integrity of any emails or any attached files. The views or opinions expressed are the author's own and may not reflect the views or opinions of Macquarie Bank.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to