Inherit properties from "parent" project in child projects (multi project)


(tulsoba) #1

I have a gradle multi projects:

sample
-> sample-a
    ->build.gradle
-> sample-b
    ->build.gradle
->build.gradle
->settings.gradle

In the “parent” gradle file I need to specify a property that I can used in all my child projects, eg.

parent=new Date()

when I do this I get:

Creating properties on demand (a.k.a. dynamic properties) has been deprecated and is scheduled to be removed in Gradle 2.0. Please read http://gradle.org/docs/current/dsl/org.gradle.api.plugins.ExtraPropertiesExtension.html for information on the replacement for dynamic properties.
Deprecated dynamic property: "parentProperty" on "project ':sample-a'", value: .....
Deprecated dynamic property "parentProperty" created in multiple locations.

Notice the property is “dynamic” it will be generated each time a build is executed. I already have a gradle.properties file for static properties.

Why will dynamic properties be deprecated in the future?


#2

Please read http://gradle.org/docs/current/dsl/org.gradle.api.plugins.ExtraPropertiesExtension.html for information on the replacement for dynamic properties.