How does ANT read properties? How to set my property system?

How does ANT read properties? How to set my property system?

Properties in ant are set in an order. Once a property is set, later the same property can not overwrite the previous one.

This process provides a good leverage of pre-setting all properties in one location, and overwriting only the needed properties. For instance, a password is to be used for an application task, and the developer does not want to share the password with his team members or developers of other teams. The following is the process to do the task:

- Store the password in ${user.home}/prj.properties file.
- Set the password – passwd = realpassword of the developer
- Master the prj.properties in include directory
  passwd = password
- Read the property files in the following order in the build.xml file
1. Type ant –Dpasswd=newpassword
2. ${user.home}/prj.properties (personal)
3. projectdirectoryname/prj.properties (project team)
4. masterincludedirectory name/prj.properties (universal)

     <cvsnttaskpasswd=${password=passwd} … />

How does ANT read properties? How to set my property system?

framework.properties

#Release information about the framework
#Thu Oct 15 17:26:13 CEST 2009
build.number=115
release.version=0.4
release.name=framework
Eg:
<target name="read.properties">
<!-- Read the properties from the release of the framework -->
<property file="framework.properties" prefix="framework"/>
<echo message="${framework.build.number}"/>
<echo message="${framework.release.version}"/>
<echo message="${framework.release.name}"/>
</target>

o/p
Buildfile: C:\build.xml
read.properties:
[echo] 115
[echo] 0.4
[echo] framework
BUILD SUCCESSFUL
Total time: 3 seconds

Setting Property Values

1. Global Ant properties can be set using the Ant preferences page
2. Window->Preferences->Ant->Runtime->Properties tab.
3. Project based properties can be set by setting the project's Ant launch configuration.
4. Click the Properties tab in the launch configuration, deselect the "Use global properties as specified in the Ant runtime preferences" checkbox, and click the Add Property button to set new properties.
Explain how to modify properties in ANT
Explain how to modify properties in ANT - We can not modify the properties in ant. The properties in ant are immutable in nature...
Explain how to use Runtime in ANT
Explain how to use Runtime in ANT - There is no need to use Runtime in ant. Because ant has Runtime counterpart by name ExecTask...
How can I use ANT to run a Java application?
How can I use ANT to run a Java application? - The following is an example to run a java application in using ant:...
Post your comment