Using artifacts as inputs for plugins

I want to do something like in the example code here:

apply plugin: 'coolPlugin'

configurations {

dependencies {
    someDependency project(path: 'superproject', configuration: 'superArtifact')

coolPlugin {
    neededFile = configurations.someDependency.files[0]

Unfotunately it doesn’t work, because I’m getting the error message that the ZIP file (artifact) is missing. Thus the artifact isn’t build, before setting it as input for the plugin. My guess is that the artifact is set as input during the configuration phase, when it is not yet build, but how can I solve this? Is it even possible at all to set an artifact as plugin input?