Ant read property from text file




















So basically, I needed a way to do a Find and Replace on the file s before other systems could consume them. There are a lot of tools and scripts out there that can do a Find and Replace for me, but I chose ANT as the solution for a couple of reasons:.

What I mean by dynamic find-replace pairs is that, for every execution, any combination of these three could change:. In scenarios like the above where you have static or dynamic key-value pairs, it is always advisable to create a separate property file that holds those pairs. We are going to setup our property file myprop.

The below is a snippet of the key-value pairs property file, where samplepairs is our Find helper that does not change. Include Property file in build. The file will be stored in a manner so that each character is examined and escaped if necessary.

The layout and comment of the original file is preserved. New properties are added at the end of the file. Existing properties are overwritten in place. Use java. Stack Gives Back Safety in numbers: crowdsourcing data on nefarious IP addresses. Featured on Meta. New post summary designs on greatest hits now, everywhere else eventually. Related Hot Network Questions. Question feed. Stack Overflow works best with JavaScript enabled.

Accept all cookies Customize settings. I need to read the value of a property from a file in an Ant script and strip off the first few characters. The property in question is. In Ant 1. This should result in a path property being loaded with the string "file:" stripped. I used the propertyregex task from Ant Contrib to do something similar. Stack Overflow for Teams — Collaborate and share knowledge with a private group.

Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Asked 13 years, 1 month ago.



0コメント

  • 1000 / 1000