On Fri, Apr 8, 2011 at 9:09 AM, Steele, Richard <r...@steelezone.net> wrote:
> I've created a reusable set of build files using the technique I outlined at
> http://stackoverflow.com/questions/5124726/what-are-some-good-ways-to-distribute-a-common-ant-file-to-be-included-in-builds/5168745#5168745.
> This technique relies heavily on Ant 1.8 importing files from the classpath
> rather than from a file.
>
> An issue I've run into, however, is how would my reusable build files (the
> ones embedded in the jar file) load a properties file or resource from that
> shared jar file?  It doesn't appear that by default either <properties
> resource=""> or <loadresource> has access to resources that are in the
> originating jar file.  I'd specify the classpath but--what would that be?
>
> I've tinkered with writing a script or custom task to help me figure out how
> to get the classpath (or classloader, for that matter) that corresponds to
> the source jar file, but without any luck.
>

Rich:
  My approach to this is a little different than yours as I
import/include resources rather than using Antlibs for my
compartmentalized build, in a manner similar to Joe Scmetzer's [1].
This allows me to make use of the ant.file.projectname and
ant.file.type.projectname properties, which I query, ultimately, in a
macrodef that uses the file vs. url information exposed therein to
understand how to obtain a relative resource.  For good measure I also
provide macrodefs to include-relative and import-relative which
themselves delegate back to the all-important macro that actually
determines what a relative resource looks like.  It might be possible
for similar properties to be added to Ant for Antlibs, but from what I
can tell so far it would indeed be a good bit trickier than the
approach I describe.

HTH,
Matt
[1] http://www.exubero.com/asl/

> Thanks,
> Rich
>

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

Reply via email to