Phing: How to export properties to file

28/11/2009

I’ve been very annoyed that I have to define properties in 2 different places. Given the following scenario:

  • config target gets called, does a bunch of property prompts
  • writeConfig target gets called, writes properties to file

You’d have to have a template file with the properties already defined, then you’d have to copy that file to a config file with the filter expand properties.

But that sucks, I only want to call propertyprompts and have those properties saved to files, so I wrote a custom task exactly for that.

You can grab this custom task from Snipplr This task has been included in Phing with version 2.4.0.

To use it:

<ExportProperties targetFile=”phing.properties” />

Enjoy!

No comments yet.

Write a comment: