Download all dependencies of a jar from artifactory using gradle

Download all dependencies of a jar from artifactory using gradle"

I have two jars A and B. I want to add a dependency between these two. So, I read a few examples available for this and came to a conclusion that we need to edit the pom.xml of B to add a dependency of A (adding info like group ID, artifactID and version of A). Then if we include B in our project, A will automatically be included. For adding the dependency information in pom.xml, I do this:

pom.withXml {
def node = asNode().appendNode(‘dependencies’).appendNode(‘dependency’)
node.appendNode(‘groupId’, ‘A’)
node.appendNode(‘artifactID’, ‘a’)
node.appendNode(‘version’, ‘1.0.0’)
}

To use this in project, in my main build.gradle I write :

classpath ‘B:b:1.0.0’

But I do not get A:a:1.0.0 included in project. So I am little confused about the approach that I am following.