You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Ben Gill <be...@hotmail.com> on 2005/05/03 20:48:37 UTC

Ant paths

Hi,

The only reason I am even including Spring.jar - is because Spring API 
supports loading of files using the ant style **/*.xml paths...  (which is 
really useful especially for my custom task..)

But in theory, I should not need to include spring.jar for this support - as 
the logic to map these paths to File resoures must be in the ant core API 
somewhere...

The question is, where are the classes that do this mapping (between path + 
file(s)), are they public, and do they have the interfaces I need?

I currently call:

org.springframework.core.io.support.PathMatchingResourcePatternResolver p =
                    new 
org.springframework.core.io.support.PathMatchingResourcePatternResolver();

                org.springframework.core.io.Resource[] resources = 
p.getResources(antStylePath);

                if (resources != null) {

                    info("Loaded [" + resources.length + "] resources from 
file");

                    for (int resourceNum=0; resourceNum < resources.length; 
resourceNum++) {

                        org.springframework.core.io.Resource resource = 
resources[resourceNum];

                        String fileName = 
resource.getFile().getAbsolutePath();
                        debug("Processing file [" + fileName + "]");

Any help on this would be appreciated - it may save me having to include the 
1.2MB spring.jar file with the distribution..

Ben

I am sure there is probably a core Ant class I could use for this support - 
the code must be in there somewhere!

But including spring works anyhow..

&gt;From: Peter Reilly &lt;peterreilly@apache.org&gt;
&gt;Reply-To: &quot;Ant Users List&quot; &lt;user@ant.apache.org&gt;
&gt;To: Ant Users List &lt;user@ant.apache.org&gt;
&gt;Subject: Re: Custom Ant Task with 3rd party library dependency
&gt;Date: Tue, 03 May 2005 17:03:31 +0100
&gt;MIME-Version: 1.0
&gt;Received: from mail.apache.org ([209.237.227.199]) by 
mc6-f39.hotmail.com with Microsoft SMTPSVC(6.0.3790.211); Tue, 3 May 2005 
09:56:47 -0700
&gt;Received: (qmail 69893 invoked by uid 500); 3 May 2005 16:05:58 -0000
&gt;Received: (qmail 69868 invoked by uid 99); 3 May 2005 16:05:57 -0000
&gt;Received: neutral (hermes.apache.org: local policy)
&gt;Received: from gate.corvil.net (HELO corvil.com) (213.94.219.177)  by 
apache.org (qpsmtpd/0.28) with ESMTP; Tue, 03 May 2005 09:05:19 -0700
&gt;Received: from [172.18.1.171] (angel.local.corvil.com [172.18.1.171])by 
corvil.com (8.13.3/8.13.3) with ESMTP id j43G3JJi098748for 
&lt;user@ant.apache.org&gt;; Tue, 3 May 2005 17:03:19 +0100 
(IST)(envelope-from peterreilly@apache.org)
&gt;X-Message-Info: JGTYoYF78jEHjJx36Oi8+Z3TmmkSEdPtfpLB7P/ybN8=
&gt;Mailing-List: contact user-help@ant.apache.org; run by ezmlm
&gt;Precedence: bulk
&gt;List-Unsubscribe: &lt;mailto:user-unsubscribe@ant.apache.org&gt;
&gt;List-Subscribe: &lt;mailto:user-subscribe@ant.apache.org&gt;
&gt;List-Help: &lt;mailto:user-help@ant.apache.org&gt;
&gt;List-Post: &lt;mailto:user@ant.apache.org&gt;
&gt;List-Id: &quot;Ant Users List&quot; &lt;user.ant.apache.org&gt;
&gt;Delivered-To: mailing list user@ant.apache.org
&gt;X-ASF-Spam-Status: No, hits=0.1 required=10.0tests=FORGED_RCVD_HELO
&gt;X-Spam-Check-By: apache.org
&gt;User-Agent: Mozilla Thunderbird 1.0 (X11/20041206)
&gt;X-Accept-Language: en-us, en
&gt;References: &lt;BAY102-F37B431599546E7D535F241CC180@phx.gbl&gt;
&gt;X-Virus-Checked: Checked
&gt;Return-Path: user-return-50004-ben_d_gill=hotmail.com@ant.apache.org
&gt;X-OriginalArrivalTime: 03 May 2005 16:56:47.0216 (UTC) 
FILETIME=[17AA6700:01C55001]
&gt;
&gt;In your resource you should not set the classpath. Doing so will
&gt;override the classpath given in the build file and cause ant to be
&gt;confused.
&gt;So just use:
&gt;  &lt;antlib&gt;
&gt;   &lt;taskdef name=&quot;renamepackages&quot;
&gt;classname=&quot;org.appfuse.ant.RenamePackages&quot;/&gt;
&gt;&lt;/antlib&gt;
&gt;
&gt;
&gt;For example:
&gt;src/testing/UseSpring.java:
&gt;package testing;
&gt;import org.springframework.beans.PropertyValue;
&gt;import org.apache.tools.ant.Task;
&gt;
&gt;public class UseSpring extends Task {
&gt;    private PropertyValue pv = new PropertyValue(&quot;hello&quot;, 
&quot;world&quot;);
&gt;    public void execute() {
&gt;        log(&quot;pv is &quot; + pv);
&gt;    }
&gt;}
&gt;src/testing/antlib.xml:
&gt;&lt;antlib&gt;
&gt;  &lt;taskdef name=&quot;usespring&quot; 
classname=&quot;testing.UseSpring&quot;/&gt;
&gt;&lt;/antlib&gt;
&gt;
&gt;build.xml:
&gt;&lt;project name=&quot;testspring&quot; default=&quot;use&quot;&gt;
&gt;  &lt;target name=&quot;jar&quot;&gt;
&gt;    &lt;mkdir dir=&quot;classes&quot;/&gt;
&gt;    &lt;javac srcdir=&quot;src&quot; destdir=&quot;classes&quot;
&gt;classpath=&quot;lib/spring.jar&quot;/&gt;
&gt;    &lt;copy todir=&quot;classes&quot;&gt;
&gt;      &lt;fileset dir=&quot;src&quot; includes=&quot;**/*.xml&quot;/&gt;
&gt;    &lt;/copy&gt;
&gt;    &lt;jar destfile=&quot;usespring.jar&quot;&gt;
&gt;      &lt;fileset dir=&quot;classes&quot;/&gt;
&gt;    &lt;/jar&gt;
&gt;  &lt;/target&gt;
&gt;
&gt;  &lt;target name=&quot;use&quot; depends=&quot;jar&quot;&gt;
&gt;    &lt;typedef resource=&quot;testing/antlib.xml&quot;
&gt;classpath=&quot;usespring.jar:lib/spring.jar&quot;/&gt;
&gt;    &lt;usespring/&gt;
&gt;  &lt;/target&gt;
&gt;&lt;/project&gt;
&gt;
&gt;
&gt;Outputs:
&gt;Searching for build.xml ...
&gt;Buildfile: /home/preilly/learning/a/spring/build.xml
&gt;
&gt;jar:
&gt;    [mkdir] Created dir: /home/preilly/learning/a/spring/classes
&gt;    [javac] Compiling 1 source file to
&gt;/home/preilly/learning/a/spring/classes
&gt;     [copy] Copying 1 file to
&gt;/home/preilly/learning/a/spring/classes
&gt;      [jar] Building jar:
&gt;/home/preilly/learning/a/spring/usespring.jar
&gt;
&gt;use:
&gt;[usespring] pv is PropertyValue: name='hello'; value=[world]
&gt;
&gt;Peter
&gt;
&gt;Ben Gill wrote:
&gt;
&gt;&gt;Hi ,
&gt;&gt;
&gt;&gt;Yes I have tried that (well a variety of this type of thing) and it
&gt;&gt;is not working for me...
&gt;&gt;
&gt;&gt;In my 'main' build.xml file I do this:
&gt;&gt;
&gt;&gt;&lt;typedef resource=&quot;org/appfuse/ant/appfuse-contrib.xml&quot;
&gt;&gt;         classpath=&quot;spring.jar;rename-packages-1.0.jar&quot;
&gt;&gt;         uri=&quot;appfuse:/org.appfuse.ant&quot;/&gt;
&gt;&gt;
&gt;&gt;Then, in my appfuse-contrib.xml file I do:
&gt;&gt;
&gt;&gt;&lt;?xml version=&quot;1.0&quot;?&gt;
&gt;&gt;&lt;antlib&gt;
&gt;&gt;
&gt;&gt;   &lt;taskdef name=&quot;renamepackages&quot;
&gt;&gt;            classname=&quot;org.appfuse.ant.RenamePackages&quot;
&gt;&gt;            classpath=&quot;spring.jar&quot;
&gt;&gt;            onerror=&quot;fail&quot;/&gt;
&gt;&gt;
&gt;&gt;&lt;/antlib&gt;
&gt;&gt;
&gt;&gt;But whatever I try setting either classpath to (or even if I use
&gt;&gt;inline classpath, or classpathref), my custom ant task cannot find
&gt;&gt;the spring classes..
&gt;&gt;
&gt;&gt;Is it possible what I am trying to do?  Eric's article + other
&gt;&gt;postings I have read seem to suggest, the only two ways of using
&gt;&gt;3rd party classes from wthin a custom task is to ether a) kick off
&gt;&gt;a new JVM task or b) put the jars in the System classpath (ie.
&gt;&gt;ANT_HOME/lib)..
&gt;&gt;
&gt;&gt;Can anyone confirm either way??
&gt;&gt;
&gt;&gt;
&gt;&gt;
&gt;&gt;
&gt;&gt;
&gt;&gt;&amp;gt;From: Ivan Ivanov 
&amp;lt;rambiusparkisanius@yahoo.com&amp;gt;
&gt;&gt;&amp;gt;Reply-To: &amp;quot;Ant Users List&amp;quot;
&gt;&gt;&amp;lt;user@ant.apache.org&amp;gt;
&gt;&gt;&amp;gt;To: Ant Users List &amp;lt;user@ant.apache.org&amp;gt;
&gt;&gt;&amp;gt;Subject: Re: Custom Ant Task with 3rd party library 
dependency
&gt;&gt;&amp;gt;Date: Tue, 3 May 2005 07:01:41 -0700 (PDT)
&gt;&gt;&amp;gt;MIME-Version: 1.0
&gt;&gt;&amp;gt;Received: from mail.apache.org ([209.237.227.199]) by
&gt;&gt;mc4-f41.hotmail.com with Microsoft SMTPSVC(6.0.3790.211); Tue, 3
&gt;&gt;May 2005 07:25:53 -0700
&gt;&gt;&amp;gt;Received: (qmail 53754 invoked by uid 500); 3 May 2005 
14:03:33
&gt;&gt;-0000
&gt;&gt;&amp;gt;Received: (qmail 53741 invoked by uid 99); 3 May 2005 
14:03:32
&gt;&gt;-0000
&gt;&gt;&amp;gt;Received: pass (hermes.apache.org: local policy)
&gt;&gt;&amp;gt;Received: from web52910.mail.yahoo.com (HELO
&gt;&gt;web52910.mail.yahoo.com) (206.190.39.187)  by apache.org
&gt;&gt;(qpsmtpd/0.28) with SMTP; Tue, 03 May 2005 07:03:32 -0700
&gt;&gt;&amp;gt;Received: (qmail 92243 invoked by uid 60001); 3 May 2005
&gt;&gt;14:01:42 -0000
&gt;&gt;&amp;gt;Received: from [212.95.183.130] by web52910.mail.yahoo.com 
via
&gt;&gt;HTTP; Tue, 03 May 2005 07:01:41 PDT
&gt;&gt;&amp;gt;X-Message-Info: JGTYoYF78jFXHutfHRffa3R5qXkgYW5muIU6wkBHhUc=
&gt;&gt;&amp;gt;Mailing-List: contact user-help@ant.apache.org; run by ezmlm
&gt;&gt;&amp;gt;Precedence: bulk
&gt;&gt;&amp;gt;List-Unsubscribe:
&gt;&gt;&amp;lt;mailto:user-unsubscribe@ant.apache.org&amp;gt;
&gt;&gt;&amp;gt;List-Subscribe: 
&amp;lt;mailto:user-subscribe@ant.apache.org&amp;gt;
&gt;&gt;&amp;gt;List-Help: &amp;lt;mailto:user-help@ant.apache.org&amp;gt;
&gt;&gt;&amp;gt;List-Post: &amp;lt;mailto:user@ant.apache.org&amp;gt;
&gt;&gt;&amp;gt;List-Id: &amp;quot;Ant Users List&amp;quot; 
&amp;lt;user.ant.apache.org&amp;gt;
&gt;&gt;&amp;gt;Delivered-To: mailing list user@ant.apache.org
&gt;&gt;&amp;gt;X-ASF-Spam-Status: No, hits=0.0 required=10.0tests=
&gt;&gt;&amp;gt;X-Spam-Check-By: apache.org
&gt;&gt;&amp;gt;Comment: DomainKeys? See 
http://antispam.yahoo.com/domainkeys
&gt;&gt;&amp;gt;DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws;  s=s1024;
&gt;&gt;d=yahoo.com;
&gt;&gt;b=hRifFK0n7F61CxssHDIcJp3K+/IJ98Ihh8+rbXJDk0osXoEzXjRUipoNSQW4NewMIiYwg/qaOtFAMDM6PMpORMjtGIkuIYAjaOUr73rgHa2PSma2ETrqsfojuM2s05Wt8DJkgzb+FD8PZp8al/NSiI6zOh5VcQoajS1LnpTcEXA=
&gt;&gt;  ;
&gt;&gt;&amp;gt;X-Virus-Checked: Checked
&gt;&gt;&amp;gt;Return-Path:
&gt;&gt;user-return-49999-ben_d_gill=hotmail.com@ant.apache.org
&gt;&gt;&amp;gt;X-OriginalArrivalTime: 03 May 2005 14:25:53.0590 (UTC)
&gt;&gt;FILETIME=[0348B560:01C54FEC]
&gt;&gt;&amp;gt;
&gt;&gt;&amp;gt;Hello Ben,
&gt;&gt;&amp;gt;
&gt;&gt;&amp;gt;Have you tried with to &amp;lt;taskdef&amp;gt; your custom 
task with
&gt;&gt;&amp;gt;classpath nested tag:
&gt;&gt;&amp;gt;&amp;lt;taskdef 
classname=&amp;quot;org.myorg.MyTask&amp;quot;&amp;gt;
&gt;&gt;&amp;gt;   &amp;lt;classpath&amp;gt;
&gt;&gt;&amp;gt;   &amp;lt;!-- location to your jars here --&amp;gt;
&gt;&gt;&amp;gt;   &amp;lt;/classpath&amp;gt;
&gt;&gt;&amp;gt;&amp;lt;/taskdef&amp;gt;
&gt;&gt;&amp;gt;
&gt;&gt;&amp;gt;HTH Ivan
&gt;&gt;&amp;gt;--- Ben Gill &amp;lt;ben_d_gill@hotmail.com&amp;gt; wrote:
&gt;&gt;&amp;gt; &amp;gt; Hi,
&gt;&gt;&amp;gt; &amp;gt;
&gt;&gt;&amp;gt; &amp;gt; My custom Ant task relies on the Spring jar files,
&gt;&gt;&amp;gt; &amp;gt; but whatever I try, I get
&gt;&gt;&amp;gt; &amp;gt; a class not found exception..
&gt;&gt;&amp;gt; &amp;gt;
&gt;&gt;&amp;gt; &amp;gt; I read a lot of posts on this and saw Eric's 
article
&gt;&gt;&amp;gt; &amp;gt; here:
&gt;&gt;&amp;gt; &amp;gt;
&gt;&gt;&amp;gt; &amp;gt;
&gt;&gt;&amp;gt;http://www.fawcette.com/javapro/2003_02/magazine/features/ehatcher/
&gt;&gt;&amp;gt; &amp;gt;
&gt;&gt;&amp;gt; &amp;gt; But I cannot believe I have to spawn off a JVM to
&gt;&gt;&amp;gt; &amp;gt; pick up the spring jar's
&gt;&gt;&amp;gt; &amp;gt; do I?
&gt;&gt;&amp;gt; &amp;gt;
&gt;&gt;&amp;gt; &amp;gt; and I really dont want to force any user that uses
&gt;&gt;&amp;gt; &amp;gt; my task to copy the jar's
&gt;&gt;&amp;gt; &amp;gt; into their $ANT_HOME/lib...
&gt;&gt;&amp;gt; &amp;gt;
&gt;&gt;&amp;gt; &amp;gt; Has anyone got a nice, tidy way of making 3rd 
party
&gt;&gt;&amp;gt; &amp;gt; jar files available to a
&gt;&gt;&amp;gt; &amp;gt; custom task?
&gt;&gt;&amp;gt; &amp;gt;
&gt;&gt;&amp;gt; &amp;gt; Thanks
&gt;&gt;&amp;gt; &amp;gt;
&gt;&gt;&amp;gt; &amp;gt;
&gt;&gt;&amp;gt; &amp;gt;
&gt;&gt;&amp;gt; &amp;gt;
&gt;&gt;&amp;gt;---------------------------------------------------------------------
&gt;&gt;&amp;gt; &amp;gt; To unsubscribe, e-mail:
&gt;&gt;&amp;gt; &amp;gt; user-unsubscribe@ant.apache.org
&gt;&gt;&amp;gt; &amp;gt; For additional commands, e-mail:
&gt;&gt;&amp;gt; &amp;gt; user-help@ant.apache.org
&gt;&gt;&amp;gt; &amp;gt;
&gt;&gt;&amp;gt; &amp;gt;
&gt;&gt;&amp;gt;
&gt;&gt;&amp;gt;
&gt;&gt;&amp;gt;
&gt;&gt;&amp;gt;__________________________________
&gt;&gt;&amp;gt;Do you Yahoo!?
&gt;&gt;&amp;gt;Yahoo! Small Business - Try our new resources site!
&gt;&gt;&amp;gt;http://smallbusiness.yahoo.com/resources/
&gt;&gt;&amp;gt;
&gt;&gt;&amp;gt;---------------------------------------------------------------------
&gt;&gt;&amp;gt;To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
&gt;&gt;&amp;gt;For additional commands, e-mail: user-help@ant.apache.org
&gt;&gt;&amp;gt;
&gt;&gt;
&gt;&gt;
&gt;&gt;
&gt;&gt;---------------------------------------------------------------------
&gt;&gt;To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
&gt;&gt;For additional commands, e-mail: user-help@ant.apache.org
&gt;&gt;
&gt;&gt;
&gt;&gt;
&gt;
&gt;
&gt;---------------------------------------------------------------------
&gt;To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
&gt;For additional commands, e-mail: user-help@ant.apache.org
&gt;



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


Re: Ant paths

Posted by Ben Gill <be...@hotmail.com>.
Hi

Yes Jan sent me a link to an article about this - it is perfect for what I 
need!!

Thanks

&gt;From: Erik Hatcher &lt;erik@ehatchersolutions.com&gt;
&gt;Reply-To: &quot;Ant Users List&quot; &lt;user@ant.apache.org&gt;
&gt;To: &quot;Ant Users List&quot; &lt;user@ant.apache.org&gt;
&gt;Subject: Re: Ant paths
&gt;Date: Wed, 4 May 2005 07:05:14 -0400
&gt;MIME-Version: 1.0 (Apple Message framework v728)
&gt;Received: from mail.apache.org ([209.237.227.199]) by 
mc10-f3.hotmail.com with Microsoft SMTPSVC(6.0.3790.211); Wed, 4 May 2005 
04:06:43 -0700
&gt;Received: (qmail 69630 invoked by uid 500); 4 May 2005 11:07:34 -0000
&gt;Received: (qmail 69572 invoked by uid 99); 4 May 2005 11:07:33 -0000
&gt;Received: pass (hermes.apache.org: local policy)
&gt;Received: from Unknown (HELO ehatchersolutions.com) (69.55.225.129)  by 
apache.org (qpsmtpd/0.28) with ESMTP; Wed, 04 May 2005 04:07:33 -0700
&gt;Received: by ehatchersolutions.com (Postfix, from userid 504)id 
BAA4213E2006; Wed,  4 May 2005 07:05:29 -0400 (EDT)
&gt;Received: from [192.168.1.101] 
(va-chrvlle-cad1-bdgrp1-4b-b-169.chvlva.adelphia.net [68.169.41.169])by 
ehatchersolutions.com (Postfix) with ESMTP id 8AE1F13E2005for 
&lt;user@ant.apache.org&gt;; Wed,  4 May 2005 07:05:16 -0400 (EDT)
&gt;X-Message-Info: JGTYoYF78jEHjJx36Oi8+Z3TmmkSEdPtfpLB7P/ybN8=
&gt;Mailing-List: contact user-help@ant.apache.org; run by ezmlm
&gt;Precedence: bulk
&gt;List-Unsubscribe: &lt;mailto:user-unsubscribe@ant.apache.org&gt;
&gt;List-Subscribe: &lt;mailto:user-subscribe@ant.apache.org&gt;
&gt;List-Help: &lt;mailto:user-help@ant.apache.org&gt;
&gt;List-Post: &lt;mailto:user@ant.apache.org&gt;
&gt;List-Id: &quot;Ant Users List&quot; &lt;user.ant.apache.org&gt;
&gt;Delivered-To: mailing list user@ant.apache.org
&gt;X-ASF-Spam-Status: No, hits=0.0 required=10.0tests=
&gt;X-Spam-Check-By: apache.org
&gt;References: &lt;BAY102-F27084D1D205632FC394B02CC180@phx.gbl&gt;
&gt;X-Mailer: Apple Mail (2.728)
&gt;X-Spam-Checker-Version: SpamAssassin 3.0.1 (2004-10-22) on javelina
&gt;X-Spam-Status: No, score=-1.2 required=5.0 
tests=AWL,BAYES_00,RCVD_IN_NJABL_DUL,RCVD_IN_SORBS_DUL autolearn=no 
version=3.0.1
&gt;X-Spam-Level:
&gt;X-Virus-Checked: Checked
&gt;Return-Path: user-return-50027-ben_d_gill=hotmail.com@ant.apache.org
&gt;X-OriginalArrivalTime: 04 May 2005 11:06:43.0534 (UTC) 
FILETIME=[5AE89EE0:01C55099]
&gt;
&gt;
&gt;On May 3, 2005, at 2:48 PM, Ben Gill wrote:
&gt;
&gt;&gt;Hi,
&gt;&gt;
&gt;&gt;The only reason I am even including Spring.jar - is because Spring
&gt;&gt;API supports loading of files using the ant style **/*.xml
&gt;&gt;paths...  (which is really useful especially for my custom task..)
&gt;&gt;
&gt;&gt;But in theory, I should not need to include spring.jar for this
&gt;&gt;support - as the logic to map these paths to File resoures must be
&gt;&gt;in the ant core API somewhere...
&gt;&gt;
&gt;&gt;The question is, where are the classes that do this mapping
&gt;&gt;(between path + file(s)), are they public, and do they have the
&gt;&gt;interfaces I need?
&gt;&gt;
&gt;&gt;I currently call:
&gt;&gt;
&gt;&gt;org.springframework.core.io.support.PathMatchingResourcePatternResolve
&gt;&gt;r p =
&gt;&gt;                    new
&gt;&gt;org.springframework.core.io.support.PathMatchingResourcePatternResolve
&gt;&gt;r();
&gt;&gt;
&gt;&gt;                org.springframework.core.io.Resource[] resources =
&gt;&gt;p.getResources(antStylePath);
&gt;&gt;
&gt;&gt;                if (resources != null) {
&gt;&gt;
&gt;&gt;                    info(&quot;Loaded [&quot; + resources.length + 
&quot;]
&gt;&gt;resources from file&quot;);
&gt;&gt;
&gt;&gt;                    for (int resourceNum=0; resourceNum &lt;
&gt;&gt;resources.length; resourceNum++) {
&gt;&gt;
&gt;&gt;                        org.springframework.core.io.Resource
&gt;&gt;resource = resources[resourceNum];
&gt;&gt;
&gt;&gt;                        String fileName = resource.getFile
&gt;&gt;().getAbsolutePath();
&gt;&gt;                        debug(&quot;Processing file [&quot; + 
fileName +
&gt;&gt;&quot;]&quot;);
&gt;&gt;
&gt;&gt;Any help on this would be appreciated - it may save me having to
&gt;&gt;include the 1.2MB spring.jar file with the distribution..
&gt;&gt;
&gt;&gt;Ben
&gt;&gt;
&gt;&gt;I am sure there is probably a core Ant class I could use for this
&gt;&gt;support - the code must be in there somewhere!
&gt;&gt;
&gt;&gt;But including spring works anyhow..
&gt;
&gt;Have a look at Ant's Fileset and the way tasks use it with the
&gt;DirectoryScanner (hopefully I'm not speaking of ancient API! :) -
&gt;the  facility to deal with patternsets (**/*.xml, for example) is
&gt;built  right in.
&gt;
&gt;Taking a look at some of Ant's tasks source code will be very
&gt;helpful  in this regard - such as the &lt;copy&gt; task.
&gt;
&gt;     Erik
&gt;
&gt;
&gt;---------------------------------------------------------------------
&gt;To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
&gt;For additional commands, e-mail: user-help@ant.apache.org
&gt;



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


Re: Ant paths

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On May 3, 2005, at 2:48 PM, Ben Gill wrote:

> Hi,
>
> The only reason I am even including Spring.jar - is because Spring  
> API supports loading of files using the ant style **/*.xml  
> paths...  (which is really useful especially for my custom task..)
>
> But in theory, I should not need to include spring.jar for this  
> support - as the logic to map these paths to File resoures must be  
> in the ant core API somewhere...
>
> The question is, where are the classes that do this mapping  
> (between path + file(s)), are they public, and do they have the  
> interfaces I need?
>
> I currently call:
>
> org.springframework.core.io.support.PathMatchingResourcePatternResolve 
> r p =
>                    new  
> org.springframework.core.io.support.PathMatchingResourcePatternResolve 
> r();
>
>                org.springframework.core.io.Resource[] resources =  
> p.getResources(antStylePath);
>
>                if (resources != null) {
>
>                    info("Loaded [" + resources.length + "]  
> resources from file");
>
>                    for (int resourceNum=0; resourceNum <  
> resources.length; resourceNum++) {
>
>                        org.springframework.core.io.Resource  
> resource = resources[resourceNum];
>
>                        String fileName = resource.getFile 
> ().getAbsolutePath();
>                        debug("Processing file [" + fileName + "]");
>
> Any help on this would be appreciated - it may save me having to  
> include the 1.2MB spring.jar file with the distribution..
>
> Ben
>
> I am sure there is probably a core Ant class I could use for this  
> support - the code must be in there somewhere!
>
> But including spring works anyhow..

Have a look at Ant's Fileset and the way tasks use it with the  
DirectoryScanner (hopefully I'm not speaking of ancient API! :) - the  
facility to deal with patternsets (**/*.xml, for example) is built  
right in.

Taking a look at some of Ant's tasks source code will be very helpful  
in this regard - such as the <copy> task.

     Erik


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