I was looking for a solution to this problem some time back :-). Didn't
know someone else might run into the same thing. I resorted to calling the
target without checking for its existence and ignoring the failure. No
longer working on that stuff :-).

Thanks Steve for asking and Vimil for suggesting the way out !

Will keep a watch on the thread if some implementation specific inputs are
shared.

Regards,
Parag Doke
Save paper, save trees. Do not print emails/documents unless absolutely
necessary.


On Thu, Nov 3, 2011 at 7:57 PM, Steve Amerige <steve.amer...@sas.com> wrote:

> Hi Vimil,
>
> Thanks for the feedback.  Any specifics on just how to do what you mention
> (even if untested)?
>
> Thanks again,
>
> Steve Amerige
> SAS Institute, Deployment Software Development
>
> On 11/3/2011 9:55 AM, Vimil Saju wrote:
>
>> I think you can use the scriptdef task to do this. You can write a script
>> within the scriptdef object to access the methods of the project object.
>> The project object has methods to list the targets defined under the
>> project, which you can use to test if a given target exists.
>> Btw antcall does not launch a new jvm, it only reloads the build.xml.
>>
>>
>> ______________________________**__
>> From: Steve Amerige<steve.amer...@sas.com>
>> To: Ant Users List<user@ant.apache.org>
>> Sent: Thursday, November 3, 2011 4:52 AM
>> Subject: Checking if a Target Exists
>>
>> Hi all,
>>
>> I want to be able to check if a target exists and hope you can help.  I'm
>> looking for a generic solution that doesn't rely any knowledge of the
>> target name to be checked.  It is not possible to modify the target code.
>>  And, I'd like to avoid any solutions that cause the entire JVM to be
>> loaded (e.g., as with antcall).
>>
>> My environment is Ant 1.7 and allows for the use of Ant-Contrib and
>> Groovy.
>>
>> Any ideas on how to do this?  Even better, any solutions anyone have to
>> share?!
>>
>> Thanks,
>> Steve Amerige
>> SAS Institute, Deployment Software Development
>>
>
>

Reply via email to