I saw some strange behavior the other day and want to verify if this is intended or a bug.
When you pull in a changing-version dependency (snapshot) I noticed that all the dynamic versioned dependencies of the dependency you pull in are also bumped to their snapshot level. I could see this as a feature or a bug, but I’m not sure which.
‘my-lib’ then declares:
When I change ‘my-lib:1.0.0 to my-lib:1.0.0-SNAPSHOT’ I also get ‘my-other-lib:2.0.X-SNAPSHOT’.
Is this intended?
Dynamic versions such as ‘2.0.+’ can resolve to snapshots in some Gradle versions (I believe there may have been a recent change to this behavior). Are you sure that this only happens if you explicitly depend on a snapshot version of some other module? I haven’t heard about this before, and it’s definitely not intended. Can you double-check?
Yes, I will try to repro and record what happens when I change a few things up. I saw it the other day and thought it was odd, but it may have always been happening and I just didn’t realize.
After some discussion, it seems like I was just noticing for the first time that using dynamic versioning will pull in snapshots in general. I would still like to verify but this raises a new question:
Can you configure Gradle such that snapshot versions will not be included when using dynamic versioning?
No, this isn’t configurable. You could use ‘latest.release’ though, if that fits your needs. I believe that very recent Gradle versions no longer resolve dynamic versions to snapshots, but I might be wrong on this.
Well we use “snapshots” in what I understand to be a non-traditional way. When a dev pushes a patchset for review, our CI system builds that and publishes the artifact before it’s merged as major.minor.buildnumber-SNAPSHOT. Apparently we came across the issue I’ve run into here before and “solved” it by only publishing snapshots to a “libs-all” repository that should not be used in production. The production repo has no snapshots.
I don’t like this because it still means you get dev Joe’s WIP branch with wtf-ever code it wants when you use dynamic versioning. But that’s our problem. Not yours (;
we have the same problem after we switched from Gradle 1.10 to Gradle 2.2.1.
This strange behavior was introduced in Gradle 1.12.
We uses dynamic version a lot for core libraries and this is a serious problem for us. In the release notes there isn’t any hint for this major change!
There is also another issue:
What was the reason for introducing this?
Don’t use dynamic versions?