I maintain an open source project using gradle which consists of multiple subprojects. Thanks to the help I received on a previous post, I was able to configure a uploadLocal
task, which will install unique snapshots into our Maven repository.
This basically works: We expose the repo via HTTPS and users are able to specify a unique snapshot in their projects. The only annoyance is that the version string of the unique snapshots will differ slightly for every subproject for the same gradle uploadLocal
invocation. Because the snapshot for every subproject is created at a slightly different time, and the timestamp is part of the unique snapshot’s version string.
Consider a typical use-case, where a user may include the open source project I maintain by putting the following lines into his build.gradle
:
ext {
smackVersion="4.2.0-rc2"
}
dependencies {
compile "org.igniterealtime.smack:smack-android:$smackVersion"
compile "org.igniterealtime.smack:smack-tcp:$smackVersion"
}
Now a bug in 4.2.0-rc2 is discovered by the user, reported, got fixed and, thanks to your CI system, a unique snapshot including the fix is pushed into our repo.
The problem is that the version string of smack-tcp
and smack-android
slightly differ. So in order for the user to test the fix, he has to change his build.gradle
as follows:
ext {
// This is now ignored.
smackVersion="4.2.0-rc2"
}
dependencies {
compile "org.igniterealtime.smack:smack-android:4.2.0-rc2-20170108.010349-3"
compile "org.igniterealtime.smack:smack-tcp:4.2.0-rc2-20170108.010503-3"
}
This is not only a problem for the user, because some setups require to declare more than two dependencies. But also for me, as I can’t simply tell the user
Your issue should be fixed fixed in 4.2.0-rc2-20170108.010503-3, please test and report back.
It would be great if the only thing the user had to change was the smackVersion
definition, so he would end up with
ext {
smackVersion="4.2.0-rc2-20170108.010503-3"
}
dependencies {
compile "org.igniterealtime.smack:smack-android:$smackVersion"
compile "org.igniterealtime.smack:smack-tcp:$smackVersion"
}
Therefore my question is: How can I generate unique snapshots with the same version string for all subprojects?