Toml version file and getting only one jar

I need to extract one file from a jar. The pom for this jar has some transitive dependencies declared.

If I had not used a toml file for all dependencies I think I just could have written @jar and only get the jar file.

Now I am using libs.versions.toml file and I wonder how to get one jar file into a configuration?

This is my attempt to solve the problem

myConfig (libs.jar.with.transitive.dependencies) {
  artifact {
    type = 'jar'
  }
}

Puts all the transitive dependencies is myConfig. I think this is as intended.
Trying to use name=‘artifactName’ doesn’t change the number of files in myConfig.

To work around the fact that I can’t get one I do the filtering on name inside the Copy task. it.getName().startsWith('artifactName')

Just use transitive = false on the dependency or configuration to only get the directly declared artifact.