Canonical way to output id string of Dependency/Artifact?

I have a plugin which does some dependency analysis (looking for implicit and unused dependencies, among other things). I’ve been using configuration.resolvedConfiguration.firstLevelModuleDependencies.moduleArtifacts to get the ResolvedArtifacts. I turn those into identifier strings in common format (group:name:version:classifier) to write out to a report file. Importantly, I can also use ResolvedArtifact to write out identifiers for other projects in the same source tree (by checking if ResolvedArtifact.getId() returns a ProjectComponentIdentifier) - e.g. project(’:otherproject’) rather than somegroup:otherproject:version.

I was considering moving over to use the newer configuration.incoming call to get the dependencies/artifacts/resolutionResult since I have seen in multiple places that it is the preferred way to do things now. As near as I can tell though, I can’t get all the identifying information for a dependency/artifact with the new APIs. Configuration.incoming returns a ResolvableDependencies. From what I can tell:

resolveableDeps.artifacts.artifacts - returns ResolvedArtifactResult. This doesn’t have a classifier field.

resolveableDeps.dependencies.artifacts - returns DependencyArtifact, This has classifier, but not group. Also, ProjectDependency doesn’t have any artifacts, so to get an id string for a project (rather than a jar), I have to process differently than I do for jars.

resolveableDeps.resolutionResults - I can get ResolvedComponentResult or DependencyResult from here, neither of which seemed to lead to a path to get me all the info I needed.

So - has anyone attempted to use the info from ResolvableDependencies to write out a dependency string, or is there some other canonical way to do it that I am not aware of?

Side note - the reason I started down this path is that I discovered the hard way that ResolvedDependency (from which you get ResolvedArtifact) does not have an identifier that hashes correctly to differentiate two dependencies that are different only in their classifier. Thus, if I happen to have this dependency statement:
dependencies {
annotationProcessor ‘org.immutables:value:2.7.5’
compileOnly ‘org.immutables:value:2.7.5:annotations’

and I combine the resulting ResolvedDependency objects into a set, I’ll only get 1 of them, not both.