Copy jars of a subproject with a specific plugin

Scenario: I have multiple subprojects, only few of which I need to have copied to an output directory, the rest are only dependencies for other subprojects. I could differentiate them by checking if the subprojects has a certain plugin applied (in this case “org.springframework.boot”). How would I do that from the root project?