I also got the requirement to collect the artifacts from a number of sub projects into a common directory. I imagine I could solve it in a similar fashion.
However, I have the feeling that this should be possible to express in a more elegant way, not having to go through the libsDir.
If you want to collect a number of artifacts from subprojects then it’s best to do it via a custom configuration and a ‘Copy’ task - this way task dependencies for building these rtifacts will be set up for you:
Note that this will only copy the artifacts produced by a project and not project dependencies. If you want to copy dependencies as well then don’t specify a configuration when defining project dependencies.