Fail to pass argument to gradle build

Hello, my situation is like below: I have declared some variables in my build:

ext{
DB="DB_$customer"
 tmpDir=new File("$buildDir/mypath/$customer")
}

Then, I have used “-P” for passing arguments to build:

gradle -P customer="CI"

Finally the build fails because it doesn’t find the customer variable. Is this related to build life cycle?

Also what does make the situation weird, I have discovered that this works for execution through console and not in Eclipse. I have tried to configure gradle in Eclipse by adding this argument in the panel of “run as->gradle build…”

Thank you very much!!

Well I found the answer for this: Actually I was setting Eclipse in the wrong panel. Well you should use Window->Preferences->Gradle and then pass your arguments.