ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Scassa <>
Subject RE: property names
Date Mon, 07 May 2001 15:38:59 GMT
Fellow ANTiers,

Ok. Perhaps the documentation provided with ant doesn't cover this issue.
I've also searched far and wide on the ANT USER List. I ventured into the
Ant Development list and realized, that was certainly not for me. My point
is that I am attempting to exhaust all of the resources available before
posting my questions. So here goes:

Up till now, I have not had reason to try and set the classpath from within
a property file or within a build.xml file. The build was simple enough that
I set my classpath variables with an external Win2k batch file, then
executed ANT; everything ran perfectly.

1. I am building two different projects with a branched .xml tree. I've got
a build-script that is called "autobuild.xml" which then calls server.xml
and webapps.xml. The Top level autobuild.xml is mostly responsible for
packaging the .class files into jars and moving them to the correct
locations, etc. 
My Problem: server.xml uses one classpath, webapps.xml is starting to
deviate on required .jars. An example would be that we now have two
different versions of xerces.jar. I need to build server.xml with
/lib/xerces.jar and webapps.xml with /webapps/lib/xerces.jar... How do I
change classpaths midstream? For that matter, how do I set the classpath
from within ANT? Is it as simple as defining a <property name="classpath"

2. Now that I have developers adding .jar files to the /lib folder at their
leisure; has anyone found a way to scan the /lib folder and build a
classpath dynamically?
   I found this snippet in the ANT User Archives:

	<pathelement path="${classpath}"/>
		<fileset dir="lib">
			<include name="**/*.jar"/>
	<pathelement location="classes"/>

When I attempt to execute this, it gives me the "could not create task of
type... Put optional.jar in the ant/lib folder. (It is there, and I cannot
find a optional task to support classpath anyway, so I figured it was
"included" with ant.)

Thanks for any responses... 


-----Original Message-----
From: Diane Holt []
Sent: Wednesday, April 11, 2001 12:35 PM
Subject: RE: property names

As with any property, these are just ways of assigning a value to a name
that can then be referenced by that name. For example, if you hard-coded a
value for the 'debug' attribute to "on" in every <javac> task instead, and
you then wanted to change it to "off", you would need to go through and
change it in every <javac> task in your build-file(s) -- whereas, if you
set a property (called "debug" in your example) to hold the value, you
could then reference that property in your <javac> tasks attributes:
  <javac debug="${debug}"
Then to change the attribute's value, you would only need to change the
*property's* definition (ie., in one place, rather than in every <javac>

The "classpath" property in your example serves both that purpose as well
as serving as a short-hand -- it's much cleaner/easier/less-error-prone to
type in a long list of paths in one place, then reference that list using
${classpath} that it would be to repeat that long list everywhere it was


--- Pinar Bicioglu <> wrote:
> I've one more question. So when we say <property name="debug" value="on"
> />,
> what do we really mean. Same thing for <property name="optimize"
> value="false" />.
> Could you also please help me to understand with the one below.
> property name="classpath"
> /jbcl3.0.jar" /> 
> Sorry for all of these silly and easy questions I ask. But since I have
> only
> one source to reference, I get stuck very often :(
> -----Original Message-----
> From: Diane Holt []
> Sent: Wednesday, April 11, 2001 12:36 PM
> To:
> Subject: Re: property names
> A property is a way to associate a value with a name that can then be
> referenced by that name, using the form ${property_name}. The property
> name is whatever you want to call it, although it's usually a good idea
> to
> call it something that says something about the value it holds. For
> example, a property to hold the path to the top of the source tree might
> be called "srcdir". Properties are used to allow for a variable value or
> as a means of having a short-hand way of referring to something.
> Diane 
> --- Pinar Bicioglu <> wrote:
> > 
> > Hi,
> > 
> > Could someone please axplain to me what the "propery name" is?
> Actually
> > the
> > question is how do we specify those? I have this build.xml file that
> > sets
> > the compiler and location options using <property name > tag. And I
> have
> > another build.xml file as a sample that sets different propert names.
> > Are
> > the names standard?
> > 
> > Thanks
> =====
> (
> __________________________________________________
> Do You Yahoo!?
> Get email at your own domain with Yahoo! Mail. 


Do You Yahoo!?
Get email at your own domain with Yahoo! Mail.

View raw message