In a gradle file, I have: (snippet)
apply plugin: 'artifactory-publish'
apply plugin: 'maven-publish'
configuration {
myConfig {
description = "my dependencies"
transitive = true
}
}
dependencies {
myConfig group: 'com.myCompany', name: 'depArt', version: 'LATEST-SNAPSHOT', ext: 'tar', classifier: 'rhel6-x86_64'
}
publishing {
publications {
myArtifacts( MavenPublication ) {
artifact( file ( "${buildDir}/distributions/${project.name}.tar" ) ) {
classifier project.classifier
}
}
}
}
When I publish this to artifactory (or just dump out the generated POM) the dependency is not listed in the pom.xml.
I know I can force it by doing:
publishing {
publications {
myArtifacts( MavenPublication ) {
artifact( file ( "${buildDir}/distributions/${project.name}.tar" ) ) {
classifier project.classifier
}
pom.withXml {
def node = asNode().appendNode( 'dependencies').appendNode( 'dependency' )
node.appendNode( 'groupId', 'com.myCompany' )
node.appendNode( 'artifactId', 'depArt' )
node.appendNode( 'version', 'LATEST-SNAPSHOT' )
node.appendNode( 'classifier', 'rhel6-x86_64' )
node.appendNode( 'scope', 'myConfig' )
}
}
}
}
but its going to be a pain to do it myself with lots of dependencies. It really seems like this should be automatic… I’ve seen examples online where other people appear to have it working for them.
Of course, that appears to be a java example, and it should be fairly obvious I’m dealing with native artifacts.
Since transitive dependency resolution doesn’t appear to work for custom configurations, I need this information in the pom file so I can at least write my own transitive resolution code… (That’s the end result of what I’m trying to get to).
Thank you.