Maven WAR Plugin
  1. Maven WAR Plugin
  2. MWAR-81

Request enhancement to pattern matching for packagingIncludes/packagingExcludes functionality (regular expressions?)

    Details

    • Type: Wish Wish
    • Status: Closed Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.2
    • Component/s: None
    • Labels:
      None
    • Environment:
      n/a
    • Number of attachments :
      2

      Description

      The Maven War Plugin currently permits choosing what files will wind up in the .war. It does this via two parameters, warSourceIncludes, and warSourceExcludes. The rule appears to be that the includes are computed, and a list of matches made, then that list is run against the excludes, and any matches taken out of the include list.

      The only wildcards that appear to be supported are *, **, and ?.

      That doesn't work well if you are packaging wars in ears, and therefore want to exclude all jars from the war, except for one or two that have to be in the war in order to run properly. "Exclude all but foo.jar and bar.jar" just doesn't translate well to "here's your simple include template, here's your simple exclude template" representation, at least with current wildcards.

      So this is a wish specifically for something to address the "exclude all but x, y, and z" need for war source includes/excludes, and a suggestion that it might be best to deprecate the warSourceIncludes/warSourceExcludes approach in favor of a single parameter that supports regular expressions instead.

        Issue Links

          Activity

          Hide
          Vincent Massol added a comment -

          Thanks a lot Joerg! That was very useful. I was able to write:

                    <!-- - Exclude JCL and LOG4J since we want all logging to go through SLF4J. Note that we're excluding
                           log4j-<version>.jar but keeping log4j-over-slf4j-<version>.jar
                         - Exclude xwiki-platform-olcore because it's already included in xwiki-platform-legacy-oldcore
                         - Exclude batik-js to prevent conflict with the patched version of Rhino used by yuicompressor used for
                           JSX. See http://jira.xwiki.org/jira/browse/XWIKI-6151 for more details.
                    -->
                    <packagingExcludes>
                      WEB-INF/lib/xwiki-platform-oldcore-*.jar,
                      WEB-INF/lib/batik-js-*.jar,
                      WEB-INF/lib/commons-logging-*.jar,
                      %regex[WEB-INF/lib/log4j-(?!over-slf4j).*.jar]
                    </packagingExcludes>
          

          Which is much nicer than what I had before

          Show
          Vincent Massol added a comment - Thanks a lot Joerg! That was very useful. I was able to write: <!-- - Exclude JCL and LOG4J since we want all logging to go through SLF4J. Note that we're excluding log4j-<version>.jar but keeping log4j-over-slf4j-<version>.jar - Exclude xwiki-platform-olcore because it's already included in xwiki-platform-legacy-oldcore - Exclude batik-js to prevent conflict with the patched version of Rhino used by yuicompressor used for JSX. See http://jira.xwiki.org/jira/browse/XWIKI-6151 for more details. --> <packagingExcludes> WEB-INF/lib/xwiki-platform-oldcore-*.jar, WEB-INF/lib/batik-js-*.jar, WEB-INF/lib/commons-logging-*.jar, %regex[WEB-INF/lib/log4j-(?!over-slf4j).*.jar] </packagingExcludes> Which is much nicer than what I had before
          Hide
          Nicolas Marcotte added a comment -

          documentations changes and a new Junit test named testSimpleWarPackagingExcludeWithIncludesRegEx

          Show
          Nicolas Marcotte added a comment - documentations changes and a new Junit test named testSimpleWarPackagingExcludeWithIncludesRegEx
          Hide
          Nicolas Marcotte added a comment -

          I have added a Junit test to reflect this capability and updated the documentation, I hope that this will make it in the next release, as this is too much of an useful feature to remain undocumented and untested! Thank you again Joerg Schaible

          Show
          Nicolas Marcotte added a comment - I have added a Junit test to reflect this capability and updated the documentation, I hope that this will make it in the next release, as this is too much of an useful feature to remain undocumented and untested! Thank you again Joerg Schaible
          Hide
          Dennis Lundberg added a comment -

          Documentation patch added in r1203638, thanks!

          Show
          Dennis Lundberg added a comment - Documentation patch added in r1203638, thanks!
          Hide
          Dennis Lundberg added a comment -

          Added documentation about an undocumented feature that solves the problem.

          Show
          Dennis Lundberg added a comment - Added documentation about an undocumented feature that solves the problem.

            People

            • Assignee:
              Dennis Lundberg
              Reporter:
              Bryan Loofbourrow
            • Votes:
              15 Vote for this issue
              Watchers:
              13 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: