Does Gradle support Ivy branches?

(Ryan Nelson) #1

Does Gradle support Ivy branches? If not, is there a suggested workaround?

Example use case: a developer creates an SCM branch of Project A to implement an experimental feature. Project A depends on Project B, which the developer also branches in the SCM. The gradle build file for the branched Project B should publish a different artifact than the mainline Project B, and the branched Project A should be able to add it as a dependency. This achieved in Ivy via branching.

Another option is using the revision attribute to manage the differences, but that seems like the wrong place for it, especially because both the mainline and branched versions of the product need to use “latest”.

Is this a use case Gradle supports?

(Peter Niederwieser) #2

I’m not aware of any explicit support for Ivy’s ‘branch’ attribute. I’d just vary the module name or classifier (e.g. ‘projectA-myBranch’).

(Stephane Galles) #3

Yes, I’ve now also switched to the ‘project-myBranch’ naming scheme for our projects and it works.

As a last resort, To be able to integrate new Gradle projects in our legacy Ivy/Ant infrastructure I had to : - modify all legacy Ant/Ivy builds to switch from the ‘branch’ feature of Ivy to the ‘project-myBranch’ naming scheme (it is essentially a matter of modifying the ivy.xml both for the module name and the dependencies) - massively republish all the modified modules in our Ivy repos (to get the new ‘project-myBranch’ naming). This was rather painful because of course the publication must be performed starting with the leaves of the dependency tree.

Now at least, our Ivy repos does not depends on the ‘branch’ feature. In a way, the situation is somewhat clearer because to have the name of the branch in the name of the module makes the location of the module very explicit. The ‘branch’ metadata sometimes hides this IMHO.