To answer myself, it seems that the following hack can do the trick:
// consumer/build.gradle
publishing {
publications {
maven(MavenPublication) {
pom.withXml {
def dependenciesNode = asNode().appendNode('dependencies')
configurations.classpath.resolvedConfiguration.resolvedArtifacts.each {
def id = it.moduleVersion.id
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', id.group)
dependencyNode.appendNode('artifactId', id.name)
dependencyNode.appendNode('version', id.version)
dependencyNode.appendNode('scope', 'runtime')
if (it.classifier) {
dependencyNode.appendNode('classifier', it.classifier)
}
if (it.type) {
dependencyNode.appendNode('type', it.type)
}
}
}
}
}
}
So I’ll change my question to, is there any way to achieve the same result with a DSL option somewhere in the variant selection/transformation API ?
Thanks a lot