Options for a dependent task

I am writing a plugin that integrates with a 3rd party API and uses an authentication token.

The plugin has a rule adding a task corresponding to each Jacoco CoverageReportTask in the task graph. Each of these tasks uses the project token, hence I made it an @Optional @Option @Input String.

It works great when I call the individual tasks, but considering that a project can have more than one coverage report, I have added an extra aggregating task that depends on all publishing tasks.

The problem is that when I call the aggregating task with an option, the build fails, as the aggregating task does not handle that option.

Is there a way for Gradle to somehow recognize that one (or more) of the tasks in the task graph handle the option and execute this scenario? This would also opens the door for enhancements such as ad-hoc overriding Maven publication repo and credentials on the command line - something which I’ve been wanting occasionally.

See here for a practical example - I can’t specify project token parameter when using the codacyUpload aggregator task, but need to upload the reports one by one.