tomcat-dev mailing list archives

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

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

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:

"/**/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

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.


That's it.


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