You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Luke Shannon <ls...@jaspersoft.com> on 2009/12/15 18:17:38 UTC

API Question - using a build file from within a jar

Hello;

 

I am looking at using the ANT API for a project I am working on. Is it
possible to set the ant.file User Property to point to a build file within
a Jar?

 

I was playing around a bit with the getResource method to get a reference
to the file, but have not had much luck being able to use that reference
to set the ant.file property.

 

Thanks,

 

Luke

 


Re: API Question - using a build file from within a jar

Posted by Stefan Bodewig <bo...@apache.org>.
On 2009-12-15, Luke Shannon <ls...@jaspersoft.com> wrote:

> I am looking at using the ANT API for a project I am working on. Is it
> possible to set the ant.file User Property to point to a build file within
> a Jar?

Do you want to import it or use it as your main build file?

Ant 1.7.1 will only work on files OOTB for either case, Ant's trunk
allows import to work on such files.

The ProjectHelper implementation used by Ant (ProjectHelper2) is able to
read from URLs (and files inside a jar do have an usable URL), so if you
implement your own Main class (see -main option) you can use URLs.

For import you'd have to write your own task.  If you look into Ant's
trunk you'll find an implementation that supports files and
URL-providing resources, but porting it to Ant 1.7.1 would require a few
changes.

Stefan

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