How do I get a list of publications for all subprojects?

I have have multiproject build where any number of subprojects may or may not have publications to Artifactory. I would like to copy all those project’s publications local directory without publishing. Is there a way to look up all subprojects publications? For instance I’m able to look up all artifacts in the build using this code, but this gives me everything.

task explodedDist(dependsOn: assemble) << {
    File explodedDist = mkdir("$buildDir/explodedDist")
    subprojects.each {project ->
        project.tasks.withType(Zip).each {archiveTask ->
            copy {
                from archiveTask.archivePath
                into explodedDist
            }
        }
    }
}
1 Like