uploadArchives does nothing in a multi-project configuration

I have a muti-project configuration, and if I use uploadArchives { repositories { add <file-repo> } } at the sub-project level, publishing works just fine.
If, however, I put allprojects { uploadArchives { repositories { add <file-repo> } } } in the top-level build.gradle, nothing happens, the build is successful, but no files are uploaded.
This is a java project with plugins java and maven, otherwise nothing special.
Any ideas what could be wrong?

The problem was caused by missing apply plugin in allprojects { }