Multi-module issue with --configure-on-demand (task not found)

In one of our multi-module builds, we apply a third-party plugin to one of the sub-modules.

We define the necessary dependency in ‘project.buildscript.dependencies {}’ and selectively apply the plugin to the module ‘foo’.

Executing ‘gradle :foo:pluginTask’ works, but ‘gradle --configure-on-demand :foo:pluginTask’ fails with the following message:

FAILURE: Could not determine which tasks to execute.
 * What went wrong:
 Task 'pluginTask' not found in root project 'X'.

Any idea?