tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kuiper, Arnout" <Arnout.Kui...@nl.origin-it.com>
Subject Ant: Jar-task ignore parameter with use of patterns
Date Tue, 04 Jan 2000 14:44:35 GMT
Hi,

After some feedback on adding pattern matching to the ignore parameter
of the Jar-task within Ant, I made an implementation. See the two files
attached.

Can someone check these files in?

The pattern matching rules are as follows.

Pattern matching is done as in UNIX:
  * mathes zero of more characters
  ? matches one character

This matching can be done on both directory names and filenames.
Filenames will be treated as one string (like in UNIX), and not as
filename.ext, like in DOS.

To match directories within a tree, the directory "name" "**" can be used.
"**" matches zero or more subdirectories

"/abc/def/**/*.class" would match every classfile in all directories
that start with "/abc/def/", thus:
  /abc/def/c.class
  /abc/def/ghi/jkl/z.class

"/**/test/*" would match all files, in all paths for which the last
directoryname is "test".

Due to the added flexibility, it is harder to distinguish what a
directory is and what a filename filter is. Therefore, a filename
filter should always be used. A special case can be when the pattern
ends with a '/' (or '\' for windows). Then anything under that
directory is matched (as if "**/*" was appended). This directory itself
can also be matched. The pattern "/test/*/" matches all subdirectories
under test, but not the files in the test directory.

If we combine all above:

Each directoryname of filename can be matched with the following
special characters:
  * mathes zero of more characters
  ? matches one character

For directories, a special character ** matches zero or more
subdirectories.

Useful examples:
"**/test/*" matches any file in a directory "test", which can be
located anywhere in the directory tree under the current directory.

"**/*.java" matches all java files in the tree mounted at the
current directory.

"/foo/bar/**/*.class" matches all class files in the /foo/bar tree.

"help/page???-*.html"

That's it.

Arnout


Mime
  • Unnamed multipart/mixed (inline, None, 0 bytes)
View raw message