ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bruce Atherton <>
Subject Re: custom selector problem
Date Tue, 21 May 2002 06:06:49 GMT
At 07:35 PM 5/17/02 -0400, Erik Hatcher wrote:
>I'm writing a custom selector and have come across a couple of issues:

Thanks for the reports. I'll look into fixing them.

>1) It won't work unless the custom selector is in the system classpath.  I'm
>getting this error and I'm using the <custom classname="..."
>classpath="..."/> construct with the right classpath.
>     "Selector org.example.MySelector not initialized, no such class"
>     In ExtendSelector I see this:
>     public void selectorCreate() {
>         if (classname != null && classname.length() > 0) {
>             try {
>                 dynselector = (ExtendFileSelector)
>                         Class.forName(classname).newInstance();
>             }

This looks like an older version of the code, before I added the actual 
implementation of the custom classpath stuff. I may have goofed up in 
copying files between machines. Hopefully the fix will be as easy as 
finding the right file.

>But this really needs to get into Ant 1.5 to make custom selectors useful.


>2) Shouldn't I be allowed to create a selector that simply implements
>FileSelector?  I can't according to the code above - I must extend
>ExtendFileSelector... but what if I don't need parameters?  No big deal
>here, just thought I'd toss it out there

Ok. So the call to addParam() could throw a build exception if the selector 
wasn't an ExtendSelector, and in isSelected() it would only call 
setParameters() for the same reason. Should be easy enough to do.

>3) My selector works great when not nested, but I tried inverting my
>selection by using:
>     <not>
>         <custom.../>
>     </not>
>     and I got this error:
>         "Internal Error: The dynamic selector is not set"
>     I looked around a little but have not found the cause of this yet -
>perhaps its due to lazy initialization somewhere?  (maybe need addConfigured
>instead of create?)

This looks similar to the error I got when trying to use selectors that 
were referenced from inside another target. Could the problem be that I 
needed to use addConfigured() instead all along? I have to admit I'm fuzzy 
on the whole add/addConfigured dichotomy, and judging by Jon's comment in 
IntrospectionHelper I'm not alone. Can anybody clarify, particularly 
regarding how it affects this?

>Thanks for having a look at these - I'll add this to my ever-growing to-do
>list that I hope to start whittling away in the next couple of weeks.

I hope to get fixes in long before then!

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

View raw message