ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Gröndal <>
Subject how to echo propertyset to file?
Date Mon, 02 Jun 2008 09:29:53 GMT
Hi all!
I have a problem echoing a set of properties to a specified file. I have a number of properties
which have a common prefix, but the exact number is undefined, so these properties are selectable
by a propertyset by I do not know the exakt number.
The reason for this somewhat uncommon setup is that I have created a common "base" file (common.xml)
that is imported into other (project specific) build files in my workspace. This saves me
a lot of time and typing since my projects have similiar setup. This base file has a target
for creating a jad-file (a sort of manifest file used in MIDlet development) which holds information
about a jar-file. The importing build files however holds some information about midlets that
is not known when creating the common base build file, and therefore I have to be able to
find these properties and print them in a generic way, regardless of how many they are.
The target just looks like this:
<!--_________Creates the jad file for the project_________
<target name="create.jad" description="Creates a jad file for the midlet suite.">
	<echo file="${}.jad" message="MIDlet-Version: ${MIDletVersion}${line.separator}"
	<echo file="${}.jad" message="MIDlet-Vendor: ${MIDletVendor}${line.separator}"
	<echo file="${}.jad" message="MIDlet-Jar-URL: ${MIDletJarUrl}${line.separator}"
	<!-- and on it goes for some more properties including my unknown number of specific properties

The properties echoed (such as MIDletVersion etc) out are set by the build file importing
the base file.

At the end of this target I would like to echo out all properties with a certain prefix. The
propertyset I want to output can be created like:

<propertyset id="midlet_properties">
	<propertyref prefix="MIDlet_"/>

But how do I echo this propertyset to the specified file? I tried using <echoproperties>
(I know this might not be the intention of echoproperties). That gives me some additional
lines at the top of the file that I do not want. I also tried using pathconvert but that really
needs a path, not a propertyset. 

Do I have to use foreach from ant-contrib? Are there any other (reasonable) way to do this?
Any suggestions are more than welcome right now.



To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message