You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Rajiv Jaitly <Ra...@lchclearnet.com> on 2005/01/07 12:14:44 UTC

Ant custom task

++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Please read the disclaimer at the bottom of this e-mail.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Hi, 

I am writing an ant task that should work on the files selected in the ant script (fileset). How would i pass a Fileset to this task  (means method signature) ? any example will be highly appreciated. 

Will this task inherit classpath specified in the ant script ? How would i get hold of the classpath in the task, i need this to check if a particular file is specified in the classpath.

Thanks

Raj


**********************************************************************
This email is intended for the named recipient(s) only. Its contents
are  confidential and may only be retained by the named recipient(s)
and may only be copied or  disclosed  with the consent of 
LCH.Clearnet Limited.   If you are not an intended recipient please
delete this e-mail and notify postmaster@lchclearnet.com.

The contents  of this  email are  subject to  contract in all cases, 
and LCH.Clearnet Limited makes no contractual commitment save where
confirmed by hard copy.  LCH.Clearnet Limited accepts no liability, 
including liability for negligence, in respect of any statement in 
this email.

LCH.Clearnet Limited, Registered Office: Aldgate House, 
33 Aldgate High Street, London EC3N 1EA.    Recognised as a Clearing 
House under the Financial Services & Markets Act 2000. Reg in England No.25932 
Telephone: +44 20 7426 7000              Internet: http://www.lchclearnet.com
**********************************************************************


Re: Ant custom task

Posted by Yves Martin <yv...@elca.ch>.
"Rajiv Jaitly" <Ra...@lchclearnet.com> writes:

> Hi, 
>
> I am writing an ant task that should work on the files selected in the
> ant script (fileset). How would i pass a Fileset to this task  (means
> method signature) ? any example will be highly appreciated. 
>
> Will this task inherit classpath specified in the ant script ? How would
> i get hold of the classpath in the task, i need this to check if a
> particular file is specified in the classpath.

 I would have ask such a question at dev@ant.apache.org

 To support filesets (you can ues a list or a vector):

    /** List of filesets */
    private List filesets = new ArrayList();

    /**
     * Add a fileset object in the filter.
     *
     * @param fs a <code>FileSet</code> value
     */
    public void addFileSet(FileSet fs) {
        filesets.add(fs);
    }


 Your task (if not in ant lib directory) will be loaded in a dedicated
 AntClassLoader by typedef. You will see the Ant JVM classpath, plus the
 classpath specified in typedef and that's all.

 If needed, your task should have a specific 'classpath' attribute to work with
 it. The method signature will be: addClassPath(Path p)

 Hope this help
-- 
Yves Martin


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org