ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nicola Ken Barozzi <nicola...@apache.org>
Subject Re: Using files in classpath in task file=""
Date Wed, 02 Apr 2003 17:43:33 GMT


Stefan Bodewig wrote, On 02/04/2003 17.34:
> On Wed, 02 Apr 2003, Nicola Ken Barozzi <nicolaken@apache.org> wrote:
> 
>>The problem is that AFAIK the xslt task needs a file, not an URL,
>>and hence not a jar resource.
> 
> Errm, where does it need the file?

Sorry, I'm not clear.
Code:

  <xslt in="index.xml" out="index.html" style="style.xsl"/>

ATM IIUC I need style.xsl in the filesystem; I cannot directly use the 
one that's in the classpath directly.

If I had it in jars I could ship it automatically with the jar that has 
the task that generated index.xml, so I can easily do something like:

  <xslt in="index.xml" out="index.html" style="resource:/a/style.xsl"/>


>>All tasks that resolve files IIUC call
>>
>>   public File resolveFile(File file, String filename)
>>
>>in FileUtils.java [1]
> 
> Most of them implicitly by defining setXYZ(File) setters, yes.
> 
>>Again IIUC and AFAIK it could be quite easy to extend this method to
>>use a url to get the "File".
> 
> Return an URL?  Receive an URL?  I don't understand what you want.

Be able to specify a URL for every task that needs a file, and that thus 
uses the above fileutils method.

In this way I could do for example:

  <ant antfile="http://url/to/buildfile/"/>
  <xslt in="index.xml" out="index.html" style="jar:/style.xsl"/>

etc

Yes, I could simply add a getStyleResource(String styleResource) to the 
task, but it would not make this change available to all tasks that use 
the above method.

Or maybe KISS and just add a getStyleResource(String styleResource). It 
solves the immediate issue and doesn't open other potential problems.

What do you think? I hope I was clearer this time =8-)

-- 
Nicola Ken Barozzi                   nicolaken@apache.org
             - verba volant, scripta manent -
    (discussions get forgotten, just code remains)
---------------------------------------------------------------------


Mime
View raw message