How do you depend on one artifact of from a project that declares two artifacts

I found an example in the repository that shows you how to create a project that produces an api and impl jar

https://github.com/gradle/gradle/blob/master/subprojects/docs/src/samples/java/apiAndImpl/build.gradle

Is it possible to declare a dependency on just the api from another (sub) project and if so what would be the syntax for that

shameless self bump

Basically, you publish the Jars under two different configurations and then depend on a particular one from the other project. Something like:

projectA.gradle

configurations {
  api
  impl
}
  artifacts {
  api taskThatProducesApiArtifact
  impl taskThatProducesImplArtifact
}

projectB.gradle

dependencies {
  compile project(path: ":projectA", configuration: "api")
}

thanks!