I am working on multi-project build using gradle. I have an requirement pick dependencies on condition of property injected at commandline .
Scenario-1:
        dependencies {
            if( ! project.hasProperty("withsources")){
             compile 'com.xx.yy:x-u:1.0.2'
            }else{
              println " with sources"
              compile project (':x-u')
            }
        }
1.Whenever I executes gradle run -Pwithsources
    it is printing "withsources" 
2. But for gradle run
    it is printing "withsources" 
Scenario-2:
        dependencies {
            if(  project.hasProperty("withsources")){
             compile 'com.xx.yy:x-u:1.0.2'
            }else{
              println " with sources"
              compile project (':x-u')
            }
        }
1.Whenever I executes gradle run -Pwithsources
    it is not printing "withsources" 
2. But for gradle run
    it is not printing "withsources" 
I don't know it always goes to else loop. Anybody can help here.