1.

How Does Ant Read Properties? How To Set My Property System?

Answer»

ANT sets properties by order, when something is set, the later same properties cannot OVERWRITE the previous ones. This is opposite to your Java SETTERS.

This give us a good leverage of preset all properties in one place, and overwrite only the needed. Give you an example here. You need password for a TASK, but don't want to share it with your team members, or not the developers outside your team.

Store your password in your ${user.home}/prj.properties
pswd=yourrealpassword
In your include directory master prj.properties
pswd=password
In your build-common.xml read properties files in this order

1. The commandline will prevail, if you use it: ant -Dpswd=newpassword
2. ${user.home}/prj.properties (personal)
3. yourprojectdir/prj.properties (project team wise)
4. your_master_include_directory/prj.properties (universal) 

<cvsnttask password="${pswd} ... />

Problem solved!

Ant sets properties by order, when something is set, the later same properties cannot overwrite the previous ones. This is opposite to your Java setters.

This give us a good leverage of preset all properties in one place, and overwrite only the needed. Give you an example here. You need password for a task, but don't want to share it with your team members, or not the developers outside your team.

Store your password in your ${user.home}/prj.properties
pswd=yourrealpassword
In your include directory master prj.properties
pswd=password
In your build-common.xml read properties files in this order

1. The commandline will prevail, if you use it: ant -Dpswd=newpassword
2. ${user.home}/prj.properties (personal)
3. yourprojectdir/prj.properties (project team wise)
4. your_master_include_directory/prj.properties (universal) 

<cvsnttask password="${pswd} ... />

Problem solved!



Discussion

No Comment Found