How to create a zip containing my project dependencies?

Given:
Multi-project gradle model (10 projects)
Each project builds an artifact and has third party dependencies on spring, log4j etc

Want:
A zip that contains all the dependencies, but not the project artifacts themselves. I want the zip containing spring and log4j, but not the artifacts created by the 10 projects (not my code).

I can create a zip that contains everything, but I want to exclude the artifacts that are my code (p1, - p5 below).

configurations {
    sharedlibraries
}

dependencies {
    sharedlibraries p1, p2, p3, p4, p5
}

task sharedLibraryArtifact(type: Zip) {
    description = 'Generates a zip artifact that contains the web application shared libraries.'
    includeEmptyDirs = false
    duplicatesStrategy = DuplicatesStrategy.EXCLUDE
    baseName = jar.baseName
    classifier = 'shared'

    from { configurations.sharedlibraries }
}

artifacts { 
    sharedlibraries sharedLibraryArtifact 
}

Why do I want this? I want to deploy all my third-party libraries separately from the ear/war. The application server has a facility to deploy libraries in a shared location, making the wars smaller and quicker to deploy.