ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kyle Adams" <kad...@gfs.com>
Subject Re: Common path definitions
Date Mon, 09 Jul 2001 18:13:09 GMT
Sounds to me like your problem is you need a standard place to put your properties file.  That
way, no matter what platform or system the file is on, Ant will always be able to find it,
and use it to locate various libraries.

If this is the case, then you might be able to make use of the ${user.home} "magic variable"
in Ant.  ${user.home} always points to the user's home directory.  For example:

Win NT      ${user.home} = c:\winnt\profiles\USERNAME
*nix           ${user.home} = /home/USERNAME

In the build.xml file:

<property file="${user.home}/build.properties" />

Now, as long as your developers are sure to put the build.properties file in their home directory,
Ant will be able to find it, no matter what system or platform its on.  There are some caveats
to this approach:

1) It assumes requiring your developers to place the properties file in their home directory
is a reasonable request.  It should be easy to use your configuration management system (be
it CVS, VSS, or whatnot) so that a standard configuration file is available for everyone to
checkout.

2) It assumes your developers know where their home directory is.  If this is a problem, simply
have your init target (you do have one, don't you?) echo the ${user.home} variable.

Kyle

>>> JPMcGrath@JPMcGrath.net 07/09/01 01:49PM >>>
I have been having a tough time setting up Ant files the way I want, and am
hoping someone can suggest an approach that will work.

I have a number of projects for which I am creating Ant build files, and
each of these projects use some number of third-party libraries.  I have to
be able to build the projects on a number of different platforms and
systems, and the paths to the library files are different on the different
systems.

I would like to create a single file that defines where the libraries are.
Ideally, this would consist of a number of path elements that points to the
JAR file(s).  Then I would like to "include" this single library definition
file into the build files for the projects.  The location of the library
definition file will vary from system to system, so I would like to pass the
name of that file to the build file as a property.

I have tried using an XML entity to include the file, but I cannot find any
way to parameterize the path to that file.  I have also tried "running" the
library definitions using the <ant> task, but that does not seem to work
either.  I can execute tasks in the file, but the paths are not available in
the calling script.

Does anyone have an idea how to accomplish this?

Regards,

John McGrath




Mime
View raw message