ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stephan beal <>
Subject Re: [Bug 7482] - PatternSet.setIncludes() does not SET includes, but appends them to a list
Date Tue, 26 Mar 2002 15:20:11 GMT
On Tuesday 26 March 2002 14:39 pm, Erik wrote
> But more importantly, perhaps discuss your needs on ant-user or ant-dev on
> what you're doing that can't already be done.

What i'm trying could very well be done via "canon ant", i was just going for 
a more developer-maintainable approach. Here's what i've got:

Before i start, let me say that i *know* my approach is non-canon. i'm just 
trying something new here, and in doing so i found a problem with 

That said...

i need to jar different parts of our source tree into different jars - a 
total of about 15 jars. i could very well do that with 15 jar tasks, no 
problem. Instead what i've chosen to do is implement it like so, in 

my.jar = de/einsurance/foo/**/*,de/einsurance/bar/**/*
my.jar.exclude = de/einsurance/foo/test/**.*
another.jar = de/somecompany/somepackage
yetanother.jar = org/apache/tools/ant/**/*
yetanother.jar.exclude = org/apache/tools/ant/taskdefs/optional/**/*

myjars = my.jar,another.jar,yetanother.jar
(yes, myjars contains property names, not values)

My object works like so:
<eijar basedir="${classes.out.dir}" 

The non-standard addition there is 'jarvarlist'. My object does the following 
with that var:

For each name in jarvarlist, we do getProject().getProperty( propertyname ), 
and that property contains a list of includes (or null). We pass that value 
to super.setIncludes(). We then look for a optional var named 
"varname.exclude", and pass that value to setExcludes(). Then we just run 
super.execute(). It works fine, except that the behaviour in PatternSet hoses 

Again - i *know* this is not a standard Ant approach, but i've done it this 
way because, quite frankly, i don't want people mucking around with the 
build.xml unless they need to, and providing this functionality via 
properties is an easy way for people do mess with it.

To be clear, i'm not pushing for a fix to make this possible, but i am saying 
that PatternSet.set{Includes,Excludes}() violates it's API docs by saying 
that it sets the value, when in fact it appends to it, and that should be 
fixed (even if the fix is an API doc update).

The 1.4.1 PatternSet code is:
public void setIncludes(String includes) {
        if (isReference()) {
            throw tooManyAttributes();
        if (includes != null && includes.length() > 0) {
            StringTokenizer tok = new StringTokenizer(includes, ", ", false);
            while (tok.hasMoreTokens()) {

As a workaround i would recommend changing it to:

public void setIncludes(String includes) {
        if (includes != null && includes.length() > 0) {
// same
	else {
		// reset the list to empty.

See ya!
----- stephan
Generic Unix Computer Guy -
Office: +49 (89)  552 92 862 Handy:  +49 (179) 211 97 67
"...control is a degree of inhibition, and a system which is perfectly
inhibited is completely frozen." -- Alan W. Watts

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message