Phing Property in property file should contain multiple values
As far as I know it is not posssible to have an array of values in a property file. What would be the best solution to store multiple values in a property?
e.g. part of property file
# directory definitions
# containing e.g. CSS, Javascript, ...
project.dirname_css = css
project.dirname_js = javascript
What I want is an array of properties like:
# directory definitions
# containing e.g. CSS, Javascript, ...
project.dirname_css = [css,portal_specific]
project.dirname_js = [javascript,portal_specific]
to loop them in the build.xml
Any suggestions how to do this? I could imagine to do divide values by ; and explode them in the build.xml. Any bette开发者_StackOverflowr suggestions?project.dirname_css = foo,bar,baz
And you will be able to iterate them with the phing forearch task :)
See: http://phing.info/docs/guide/trunk/chapters/appendixes/AppendixB-CoreTasks.html#ForeachTask
Coming across this a few years down the road. The provided link in Christoph's answer has changed to: https://www.phing.info/docs/guide/trunk/ForeachTask.html
Also here is my solution, using Christoph's idea. In my case, I had certain shell script files I needed to make sure where owner/group read/writeable:
// In the properties file:
project.perm775files = app/blocker.sh,app/tester.sh
// In the build xml file
<foreach list="${project.perm775files}" delimiter="," param="filepath" target="perm775" />
<target name="perm775">
<exec command="sudo chmod 775 ${filepath}" />
</target>
精彩评论