Task Configuration Avoidance and Publishing

When using task configuration avoidance, I have noticed that when then output of a task is used as in artifact in publishing that it is always configured. Is there a method for avoiding task configuration when its output is published?

publishing {
    publications {
        allResources(MavenPublication) {
            artifact generateResourceTask
        }
    }
}

in this case the ‘generateResourceTask’ task (and the tasks it depends upon) will always be configured.