سؤال

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