How to enable custom standalone plugin project to receive its configuration properties from either system properties or values provided in gradle.build

I am building a gradle plugin as a standalone project. That plugin, when used, expects different configurational properties. I want to enable the consumers of my plugin to be able to pass the configurational properties as either system properties or provide them in the build.gradle file.

So far,

  • I have seen ways to achieve reading configurational properties from the terminal - using the @Option annotation.

  • I have seen ways to achieve reading configurational properties from the build.gradle file - using project extensions.

I can’t seem to combine the 2, though. Maven, for example, has the simple @Paramter annotation and it handles default values, whether field is required or not and allows passing the actual value from the terminal or the .pom file.

Any help with actual examples will be greatly appreciated.