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?

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top