keyValue pair in gradle.properties


(smurfs.doll) #1

Hi

Is it possible to give as keyValue pair in gradle.properties. If so, how to access them from build.gradle.

gradle.properties:

Vers=[[test:1.0],[test1:2.0]]

In build.gradle, if i give as test,it should return 1.0. Is it possible to do that?

Thanks Smurf


(smurfs.doll) #2

Why, i need this functionality is:

I am working on a multi module project and each project will be having differnt version. I am planning to have the project name and the version in gradle.properties and iterate that in build.gradle.

Or is there a a different way of doing this Please let me know


(smurfs.doll) #3

I have resolved this in another way.

Thanks…


(Vincent Cantin) #4
  1. If it is project specific, then it doesn’t have to be in graddle.properties, and you might want it to be saved by your version control system as well. 2. If it is for a multi-project, then maybe you can have this information inside the root build file.

(smurfs.doll) #5

ok. thanks … Also, one more question.

Is it possible to add a project dependency based on some property?

For example: In build.gradle, can i do as below:

if(testProject) { compile “com.test:testComponent:1.0” }


(Vincent Cantin) #6

I don’t see any reason why you couldn’t.