Exclude a sub-project from upload archives using the Java and Maven plugins?

What’s the best way to exclude a subproject from being uploaded during an uploadArchives operation? For example, a multi project build contains sub-projects A, B and C. The build is configured such that:

configure(subprojects) { -> project
    uploadArchives { ... }
}
  project("C") {
    configurations.archives.artifacts.clear()
}

This “works” in that sub-project C is not uploaded. However, an error occurs during upload (the other sub-projects do succeed).

[ant:null] Error reading settings file '/private/var/folders/dx/20j0yvj95d9dl1kwbv9wyn500000gn/T/gradle_empty_settings5774924123782562128.xml' - ignoring. Error was: /private/var/folders/dx/20j0yvj95d9dl1kwbv9wyn500000gn/T/gradle_empty_settings5774924123782562128.xml (No such file or directory)

How do I correctly suppress the sub-project?

A simple solution (which works for any task) is ‘uploadArchives.enabled = false’.

Perfect, thanks!