The easiest way to turn a resource ID into something that can be echoed is to set a property via a resource ID:
<propertyset id="midlet_properties"> <propertyref prefix="MIDlet_"/> </propertyset> <property name="midlet_property_set" refid="midlet_properties"/> <echo>Property Set: ${midlet_property_set}</echo> I just ran a test: project name="myapp" default="test" basedir="."> <target name="test"> <property name="bar_one" value="one"/> <property name="bar_two" value="two"/> <property name="bar_three" value="three"/> <property name="bar_four" value="four"/> <property name="foo_one" value="one"/> <property name="foo_two" value="two"/> <property name="foo_three" value="three"/> <property name="foo_four" value="four"/> <propertyset id="foo_props"> <propertyref prefix="foo_"/> </propertyset> <property name="foo_prop" refid="foo_props"/> <echo>Property = "${foo_prop}"</echo> </target> </project> /Users/david$ ant Buildfile: build.xml test: [echo] Property = "foo_four=four, foo_one=one, foo_three=three, foo_two=two" BUILD SUCCESSFUL Total time: 2 seconds Is this what you're looking for? On Mon, Jun 2, 2008 at 5:29 AM, Daniel Gröndal <[EMAIL PROTECTED]> wrote: > 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="${ant.project.name}.jad" message="MIDlet-Version: > ${MIDletVersion}${line.separator}" append="true"/> > <echo file="${ant.project.name}.jad" message="MIDlet-Vendor: > ${MIDletVendor}${line.separator}" append="true"/> > <echo file="${ant.project.name}.jad" message="MIDlet-Jar-URL: > ${MIDletJarUrl}${line.separator}" append="true"/> > <!-- and on it goes for some more properties including my unknown > number of specific properties --> > </target> > > 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_"/> > </propertyset> > > 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. > > Thanks, > > //daniel > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- -- David Weintraub [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]