xml - maven-jar-plugin includes vs excludes -
i've got existing pom file includes maven-jar-plugin section. runs test-jar goal , excluding few directories:
<excludes> <exclude>...</exclude> <exclude>...</exclude> <exclude>somedir/**</exclude> </excludes> i need include file in somedir directory leave out rest of files in somedir directory. i've read includes have precedence on excludes added following (there no includes section before):
<includes> <include>somedir/somefile.xml</include> </includes> this ends creating jar file test few files in (just stuff in meta-inf). file included not in jar either. i'd expect jar identical jar created before includes change 1 additional file.
what missing here?
first, if don't specify includes, maven jar plugin use **/** default pattern (see o.a.m.p.j.abstractjarmojo) i.e. include everything. if override default pattern, plugin include tell him include.
second, directory scanning done @ end o.c.p.u.directoryscanner , javadoc of class says:
* idea simple. given directory recursively scanned files * , directories. each file/directory matched against set of selectors, * including special support matching against filenames include , * , exclude patterns. files/directories match @ least 1 * pattern of include pattern list or other file selector, , don't match * pattern of exclude pattern list or fail match against required * selector placed in list of files/directories found.
so, current set of includes , excludes patterns, one file match inclusion pattern match exclusion pattern , not selected , empty archive (with default manifest, see o.a.m.p.j.abstractjarmojo#createarchive()).
i can't give exact solution here need rethink way include/exclude files (e.g. add more includes patterns, remove <exclude>somedir/**</exclude>, or use includes only, or use excludes only).
Comments
Post a Comment