Unable to get the value of ExtraPropertiesExtension in gradle


(SubratMohapatra) #1

I am trying to use the ExtraPropertiesExtension in gradle
And specifying in the build.gradle
project.ext {
propertyA = true
}

Now in the repo which has the plugin implementation … when I try to access the property…
project.hasProperty(“propertyA”)
it returns false…

Any clue where I may be going wrong…


(SubratMohapatra) #2

Never mind, figured out the solution. Just in case it helps others to save time:
Trying to access the property value in the Plugin Class (Configuration phase) then we need to declare the property in build.gradle before applying the plugin.

Trying to access the property value in the Task, then order of declaration in build.gradle doesnot matter.