rapport89
rapport89

Reputation: 109

How would I create a gradle property with two values?

I want to pass property for my Gradle project in command line. But this property has two values for example:

Let's say that I pass the property something like this

gradle myTask -Pexclude=xxxxx,yyyyy

Above, I have passed two values in the property exclude. What exclude does is that it excludes the two files from the build process. But I am confused that these comma separated format would work or not. Please advise.

Upvotes: 0

Views: 675

Answers (1)

Amnon Shochot
Amnon Shochot

Reputation: 9386

When you're using the -P flag you're actually setting a property with a String value, i.e. the value of the exclude property in your example will be set to xxxxx,yyyyy.

If you'd like to convert this value into an Array you can simply use split(), i.e. def excludeArr = exclude.split(",")

Upvotes: 1

Related Questions