ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diane Holt <hol...@yahoo.com>
Subject Re: Common path definitions
Date Mon, 09 Jul 2001 18:31:04 GMT
I don't know that I'd recommend having a requirement that a file used in
the production of the build be placed in a user's home directory -- you
can allow for the option of users having a properties file in their home
directory in order to set the value of customizable properties, but you
shouldn't have a requirement that their home directory contains a
properties file necessary to the build. If you have properties files you
include as part of the build, better to have them in the tree the
build-files live in (presumably, your source-tree).

As to the original poster's question: If you make the path definitions
properties, and put those properties into properties files, you don't need
to do any "including" or "running" -- just read them in using the
<property file=.../> task.

Diane

--- Kyle Adams <kadams@gfs.com> wrote:
> 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
> 
> 
> 


=====
(holtdl@yahoo.com)



__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

Mime
View raw message