[EMAIL PROTECTED] schrieb:
Thanks a lot. I know that JAVA_HOME is not the ANT - property.
I just wanted to check whether can we change the property value at run time.

Can we have detail list of different properties that ANT supports.??

Some stuff that might be helpful to get you started ...


1. the builtin properties

use =

<echoproperties prefix="java"/>
<echoproperties prefix="ant"/>

or

<echoproperties prefix="java" destfile="ant_java.properties"/>
<echoproperties prefix="ant" destfile="ant_default.properties"/>

to see all java / ant's default properties that are automatically set
for any ant script.

2. properties set via -D ...

as with all java apps you can set propertyvalues with -Dpropertyname=value

f.e. in bla.xml you have

<property name="antlogfile" value="/test/logs/ant.log"/>
...
<record name="${antlogfile}" action="start"/>
...
<record name=${antlogfile}" action="stop"/>

when starting ant with
ant -Dantlogfile=/log/ant.log -f mybuild.xml
${antlogfile} holds /log/ant.log
when starting only with
ant -f bla.xml
${antlogfile} holds /test/logs/ant.log

that can be used for defaults

see =
http://ant.apache.org/manual/running.html#commandline

3. the properties set via property /xmlproperty file

you have a file foo.properties with key=value pattern, f.e.
key1=value
key2=anothervalue
...

load the properties in your build.xml

 <property file="foo.properties"/>

<echo>$${key} == ${key1}${line.separator}$${key2} == ${key2}</echo>

btw. $$ is the masking for a $
${line.separator} is one of those builtin java properties, so
the example gets

${key1} == value
${key2} == anothervalue

4. files set via call to ant api by script or special ant tasks

normally ant properties are immutable once set,
but it's possible to overwrite them with the method
project.setProperty("propertyname", "value") called in an ant task
or with <script> task

f.e.

<property name="foo" value="bar"/>

<target name="depends">
   <script language="ruby">
   <![CDATA[
     $project.setProperty "foo", "baz"
   ]]>
   </script>
</target>

<target name="main" depends="depends">
   <echo>
     $${foobar} == ${foobar}
   </echo>
</target>


guess what's the value of foo ...

You'll find special ant tasks that use the same behaviour in

http://antelope.tigris.org/
http://antxtras.sourceforge.net/
http://ant-contrib.sourceforge.net/

But beware, this is against normal ant behaviour !
Only recommended for advanced uses and only when you need to.

there's also a method to set a new property
project.setNewProperty("propertyname", "value")
without overwriting some existing property


4. finally a speciality about filesets

with

<fileset dir="C:/foobar" id="yourID">
 <include name="**/*.xml"/>
</fileset>

the property ${toString:yourID} is automatically set and
holds all files caught by your include pattern in a comma
separated list

you may use that list for further processing, f.e. echoing
to a file, withn <script>, in a task that provides a kind of for loop

in addition = consult the ant manuel and ant user list archives


Regards, Gilbert






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to