Maven 1.x War Plugin
  1. Maven 1.x War Plugin
  2. MPWAR-41

Ability to merge other war files as dependencies

    Details

    • Type: New Feature New Feature
    • Status: Open Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.6
    • Fix Version/s: None
    • Labels:
      None
    • Number of attachments :
      1

      Description

      In a project I'm working on, we need to be able to separate parts of our web applications, to be able to build different versions, with or without certain features.
      Since some of these "parts" use jsp's, have specific dependencies, etc... we can't just build them as jars.

      I've made the attached patch in order to be able to specify a dependency of type war and have it included in my "master" war.

      Note that for this to work, the dependent war should not have a web.xml, for instance. As it is, it simply unwar's the dependency in the main build directory. It might be desired to actually run this before copying the resources from the master project, so that at least they don't get overwritten by the dependencies'.
      Currently, the META-INF content and the web.xml are excluded from the unwar task, maybe more excludes should be added?

      1. maven-war-includewar.patch
        0.8 kB
        Grégory Joseph (old account)

        Activity

        Hide
        Jerome Lacoste added a comment -

        If you change this issue into: "allow to unpack dependencies in a specific place of the war file", then I would vote for it.

        I.e. you specify a dependency like this:

        <dependency>
        <id>myWebstartApp</id>
        <version>1.3</version>
        <type>zip</type>
        <properties>
        <war.target.path>apps</war.target.path>
        <war.unzip>true</war.unzip>
        </properties>
        </dependency>

        It's more general and would solve my issue of adding artifacts that are bundled in zip files (e.g. as a result of creating a webapp using jnlp).

        that's the only clean&simple way I've found in order to make the resulting numerous signed jars of a particular jnlp module available as a single artifact.

        Show
        Jerome Lacoste added a comment - If you change this issue into: "allow to unpack dependencies in a specific place of the war file", then I would vote for it. I.e. you specify a dependency like this: <dependency> <id>myWebstartApp</id> <version>1.3</version> <type>zip</type> <properties> <war.target.path>apps</war.target.path> <war.unzip>true</war.unzip> </properties> </dependency> It's more general and would solve my issue of adding artifacts that are bundled in zip files (e.g. as a result of creating a webapp using jnlp). that's the only clean&simple way I've found in order to make the resulting numerous signed jars of a particular jnlp module available as a single artifact.
        Hide
        Grégory Joseph (old account) added a comment -

        Seems I can't edit/rename, sorry, but yes, a generic way of merging artifacts would be fine.

        Show
        Grégory Joseph (old account) added a comment - Seems I can't edit/rename, sorry, but yes, a generic way of merging artifacts would be fine.
        Hide
        Kees Jongenburger added a comment -

        Yes. this will greatly improve the usability of the war plugin.
        it's really a smal change that make a world of difference.

        <j:set var="targetPath" value="$

        {dep.getProperty('war.target.path')}

        "/>
        <j:set var="unzip" value="$

        {dep.getProperty('war.unzip')}

        "/>
        <j:if test="$

        {!empty(unzip)}

        ">
        <ant:unjar dest="$

        {maven.war.webapp.dir}/${targetPath}" src="${lib.path}"/>
        </j:if>
        <j:if test="${empty(unzip)}">
        <j:if test="${!empty(targetPath)}">
        <ant:copy todir="${maven.war.webapp.dir}

        /$

        {targetPath}

        " file="$

        {lib.path}

        "/>
        </j:if>
        </j:if>

        Show
        Kees Jongenburger added a comment - Yes. this will greatly improve the usability of the war plugin. it's really a smal change that make a world of difference. <j:set var="targetPath" value="$ {dep.getProperty('war.target.path')} "/> <j:set var="unzip" value="$ {dep.getProperty('war.unzip')} "/> <j:if test="$ {!empty(unzip)} "> <ant:unjar dest="$ {maven.war.webapp.dir}/${targetPath}" src="${lib.path}"/> </j:if> <j:if test="${empty(unzip)}"> <j:if test="${!empty(targetPath)}"> <ant:copy todir="${maven.war.webapp.dir} /$ {targetPath} " file="$ {lib.path} "/> </j:if> </j:if>
        Hide
        thierry lach added a comment -

        It would be great if there was a war goal that would create one of these webxml-less war files also. We've got a great use for this feature.

        Show
        thierry lach added a comment - It would be great if there was a war goal that would create one of these webxml-less war files also. We've got a great use for this feature.
        Hide
        Kalle Korhonen added a comment -

        Yeap, I'd also need this solved in a generic way. I'd simply want to include a zip dependency into a war. Currently it seems only jar dependencies are packaged into the war.

        Show
        Kalle Korhonen added a comment - Yeap, I'd also need this solved in a generic way. I'd simply want to include a zip dependency into a war. Currently it seems only jar dependencies are packaged into the war.

          People

          • Assignee:
            Unassigned
            Reporter:
            Grégory Joseph (old account)
          • Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated: