The Phing property in the property file must contain several values

As far as I know, it is not possible to have an array of values ​​in a properties file. What would be the best solution to store multiple values ​​in a property?

eg. part of the properties file

# directory definitions # containing eg CSS, Javascript, ... project.dirname_css = css project.dirname_js = javascript 

What I want is an array of properties such as:

 # directory definitions # containing eg CSS, Javascript, ... project.dirname_css = [css,portal_specific] project.dirname_js = [javascript,portal_specific] 

to encode them in build.xml
Any suggestions on how to do this?
I could imagine sharing values; and explode them in the build.xml file. Any best deals?

+4
source share
2 answers
 project.dirname_css = foo,bar,baz 

And you can repeat them using the phing search task :)

See: http://phing.info/docs/guide/trunk/chapters/appendixes/AppendixB-CoreTasks.html#ForeachTask

+7
source

Having gone through this a few years ago. The link provided by Christophe in response changed to: https://www.phing.info/docs/guide/trunk/ForeachTask.html

And here is my solution using Christophe's idea. In my case, I had certain script shell files that I needed to make sure that the owner / group is reading / writing:

 // 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> 
-1
source

Source: https://habr.com/ru/post/1334687/


All Articles