How to set distributionBaseName in an included build?

I am working on a composite build, and one of the included builds uses the Distribution plugin (via the JVM Application plugin). I would like to change the value of distribution.main.distributionBaseName in the included build using logic in the top-level including build.

I note from Properties defined in 'gradle.properties' should be passed down to child builds · Issue #2534 · gradle/gradle · GitHub that properties are propagated into included builds, but only when defined with the -P cli option. This doesn’t help me here because I only know the value after the build has started.

I could write some hack that involves the top-level build writing a settings file that is read by the included build, but I would prefer a more direct method. Can anyone suggest a good way of doing this? Or am I missing something simple? I am fairly new to Gradle. I am using version 6.8.3 at the moment but I would happily upgrade if a more recent version offers something that would help here.

Thanks for any suggestions.

1 Like