Setting ant property with bash command result

How can I set the ant property to a value that is the result of executing a bash script? For example, I need a target program that uses the svn and bash utilities to control the build progress. More specifically, the target I am trying to create will be used to determine if there are modified files in the deployed application via the command:

svn stat | awk -F ''  ' $1=="A" || $1 == "C" || $1=="M" || $1 == "D" || $1 == "R" {print $1}' | wc -l

      

I need to set the result of this command to some kind of property $ {modified_lines_number}.

+2


source to share


2 answers


Assuming you are using the exec task to execute this command, this task has an attribute outputproperty

that allows you to specify the name of the property in which the output will be saved.



+2


source


You can write the output of your command like this:

OUTPUT=$(snv stat | ... | wc -l)

      



... and define a property for ant like this:

ant -Dmodified_lines_number=$OUTPUT

      

0


source







All Articles