The "partial WAR" strategy has been used in several places throughout the RSF samples and projects in order to achieve a kind of "inheritance" amongst related WAR projects. For example the various versions of the NumberGuessing sample targetted at different environments (standalone Servlets, JSR-168 portlets and Sakai) make use of a "base WAR" containing all the portable definitions for the app (some view templates, Spring files, implementation logic) but omitting the nonportable parts (web.xml, further templates). This base or "partial WAR" is then imported into different concrete projects, one for each environment, which "hydrate" it by adding the smattering of extra packaging required for that environment.

Unfortunate, Maven, the build system used for RSF and all associated projects, does not recognise WAR composition as a basic activity, so these build steps need to be automated manually, using the maven.xml file written using the Jelly scripting language supported by Maven 1.x.

The following stanza is used in all projects requiring to built with partial WARs as dependencies:

<!-- This standard stanza is required for any webapps participating in the
   "partial WAR" build strategy -->
  <preGoal name="war:webapp">
    <echo>Expanding webapp dependencies</echo>

    <mkdir dir="${maven.war.webapp.dir}" />
    <j:forEach var="lib" items="${pom.artifacts}">
      <j:set var="dep" value="${lib.dependency}" />
      <j:if test="${dep.getProperty('explode') == 'true'}">
        <j:if test="${dep.type =='war'}">
          <unjar src="${lib.path}" dest="${maven.war.webapp.dir}" />
        </j:if>
      </j:if>
    </j:forEach>
  </preGoal>

Add new attachment

Only authorized users are allowed to upload new attachments.
« This page (revision-) was last changed on 22-Feb-2007 21:04 by UnknownAuthor