Get project SrcDir for sub-module dependencies

We have a requirement where we want to skip certain downstream jenkins jobs if the modified files exist in a list of modules which is generated from runtimeResolvedConfiguraiton of a project.

I am able to get the list of subModules. But how to I get the srcDirs of these subModules?

task getModuleDepsSrcPath << {

project.configurations.runtime.resolvedConfiguration.resolvedArtifacts.each { ResolvedArtifact artifact ->
def id =
if (id instanceof ProjectComponentIdentifier) {

The list of modified files exists locally. I will read that separately.