ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <e...@ehatchersolutions.com>
Subject Re: Ant paths
Date Wed, 04 May 2005 11:05:14 GMT

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


Mime
View raw message