Question

I have the following in build.gradle:

PlatformUmbrella platformUmbrella = PlatformUmbrella.create(System.properties['module.status'])

task setClBeforePublish << platformUmbrella.beforePublish

project.tasks.publish.doLast platformUmbrella.afterPublish

and gradle.properties has module.status = snapshot``gradlew properties outputs:

module.status: snapshot

But when either System.properties['module.status'] or gradle.properties['module.status'] is retrieved, null is returned (presumably because properties haven't been processed yet). Accessing gradle.properties['module.status'] inside a gradle.taskGraph.whenReady closure also returns null. What's the right way to access the 'module.status' setting?

Was it helpful?

Solution

Contents of gradle.properties will be automatically loaded into the project's "extra" properties extension, which are accessed via project.ext.

In your case, try project.ext["module.status"] instead.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top