[GRADLE-2472] Maven snapshots are not being updated Created: 12/Sep/12 Updated: 10/Feb/17 Resolved: 10/Feb/17 |
|
Status: | Resolved |
Project: | Gradle |
Affects Version/s: | None |
Fix Version/s: | None |
Type: | Bug | ||
Reporter: | Gradle Forums | Assignee: | Unassigned |
Resolution: | Won't Fix | Votes: | 11 |
Issue Links: |
|
Description |
Hi folks, For me that's not happening. Its only when I add the --refresh-dependencies switch that the remote jar will be downloaded. This was a reported bug quite some time ago but was marked as resolved, seemingly without a specific fix being made. It gets worse if I'm using a local Maven repo. If another member of the team updates a dependency and it gets deployed to the remote repo my local build will not pull it down. Gradle sees the local Maven repo at the beginning of the repository chain, finds a version that matches what it has in its local cache and thinks that there is nothing to download. Not even the --refresh-dependencies switch works in this case. I need the local Maven repo to workaround the fact that Gradle doesn't publish to its own local cache. See So I'm in a bit of a catch 22. Does anyone have any suggestions on to how to work effectively with snapshots? Is there a more Gradle-centric way of doing things? I'm using Gradle version 1.1 [1]http://forums.gradle.org/gradle/topic... [2]http://forums.gradle.org/gradle/topic... |
Comments |
Comment by Gradle Forums [ 12/Sep/12 ] |
Changing modules are cached for 24 hours by default (same as in Maven). See [ResolutionStrategy]([1]http://gradle.org/docs/current/dsl/or...) for how to configure the TTL. Gradle isn't currently capable of searching for the latest snapshot across repositories (e.g. remote and local). If you often need to update dependencies locally, one potential solution is to make them part of the same multi-project build. |
Comment by Gradle Forums [ 12/Sep/12 ] |
Hi Peter, My understanding of multi-module builds is that all the projects are on the same release cycle. In other words, they all share the same version number, which they inherit from the master module, and therefore they all get released and tagged at the same time. Most of my projects have independent release cycles and I want to be able to treat them as standalone modules for the purpose of checking out, branching, merging, tagging etc. I also don't want them to rely on a filesystem reference to any other project or build script. From the point of view of one project that is dependent on another, it just sees the other project as a classpath dependency. So with that in mind, I don't think I can use multi-module features. Please correct me if I'm wrong. Regarding ResolutionStrategy, I think I understand your point. It sounds like you're saying that newer snapshots in the remote repository are not supposed to be pulled down within the TTL period. That sounds fine to me and its definitely what I'm seeing. It just wasn't clear to me from Daz's posting that that was the intended behaviour. Having to use the --refresh-dependencies switch in order to force updates of cached dependencies is not a problem. However, when combined with a local Maven repo it won't work. So I think I'm still stuck. Is there any way I can work on multiple projects locally and still get correct behaviour with regards to updating snapshots? Is there any plan to be able to order snapshots by timestamp? I don't see how we can manage snapshots reliably without knowing which one is newest. |
Comment by Gradle Forums [ 12/Sep/12 ] |
I think the best you can do as of now is to conditionally include either the remote or the local Maven repo based on, say, the value of a system property. I hope we'll soon have a better solution but can't make any promises. |
Comment by Kevin Stembridge [ 15/Sep/12 ] |
I got the Jira number wrong in the original posting when referring to the local cache. Instead of |
Comment by Sebastien Tardif [ 04/Oct/13 ] |
If we could have the concept of be able to get the "more" recent artifact from a set of repos that would handle this. It's not clear that even a custom http://www.gradle.org/docs/current/dsl/org.gradle.api.artifacts.ResolutionStrategy.html could handle that. |
Comment by Kevin Stembridge [ 24/Nov/13 ] |
I'm happy to see new releases of Gradle coming out but I'm a little disappointed that this issue is being ignored. Improving the performance of Gradle is nice but this issue is a blocker for adoption on projects that have many independent multi-module projects. After spending a couple of years on projects using Gradle (which was great) I'm now back on a Maven project (not so great). I'd love to be able to recommend that we move to Gradle but due to this issue I can't honestly say that we would be better off. I didn't get a response to my last posting on the forum. I've reposted it here because the original description in this jira doesn't adequately explain the problem.
|
Comment by Youri Bonnaffé [ 24/Nov/13 ] |
This is for me one of the main drawback using Gradle. Especially when using Git you tend to have several repositories with several independent multi module projects instead of one big trunk with SVN. |
Comment by Prasanna P [ 17/Mar/14 ] |
Our company moved to gradle but was hit by this snag. Multiproject is not an option for us. It would be nice if there would be some solution to this, since we'd like to continue using Gradle. Our workaround is to use timestamped versions (which is not a snapshot in maven concept, but similar), and it forces every developer to check for the latest timestamp before the build. This is not idea, but at least seems to be working. |
Comment by Prasanna P [ 18/Mar/14 ] |
Suggestion: Can we have: } This is basically treating local maven as a special repo, where for changing versions (snapshots), it checks the timestamps for a given checksum with multiple urls configured |
Comment by Mauro Molinari [ 01/Oct/14 ] |
I think at least part of this is a duplicate of However, there's also a foundamental problem when you deal with just a Maven local repository: a SNAPSHOT module JAR does not get refreshed by Gradle even if it has changed in the local .m2 repo meanwhile. I tried the following:
The only workaround I found is to remove the dependency from the build script, perform an action, then re-add the dependency to the build script... after this, the updated JAR is finally retrieved from the local Maven repo. This is extremely annoying when using Gradle inside an IDE (STS) to manage your project dependencies: refreshing dependencies becomes problem when dealing with "temporary" or "under development" modules coming from different (multi) projects. Could this be finally fixed please? I'm currently using Gradle 2.1. |
Comment by Steve Ash [ 21/Jul/16 ] |
2016 and we're hitting this as well. How are other people working around this? The best that we have done is just not ever committing the mavenLocal() repo and if you as an individual developer need to work on multiple projects at the same time, then the dev uncomments the mavenLocal() and refreshes to pick up the local SNAPSHOT dependencies. Then before pushing, just re-comment it out. Our use case is similar to the original poster: we have a few "core" libraries (company java commons, team commons, shared module across multiple products, etc.). All of these are versioned and released in different lifecycles and thus are separate projects. Each dev that works on these will have clones or forks of the git repos and will work locally then push their changes once complete to the CI server which will publish to our company artifactory snapshot repo. Eventually (before release) we will coordinate releases of all of the shared modules. The maven behavior of pulling the "latest" SNAPSHOT (by timestamp) across repos (at least across local vs our company artifactory repo) is perfectly acceptable. Not perfect, but certainly better than the fragile solution of un-/re-commenting build config files. I thought we could get this behavior by doing something like declaring the dependency 3.6.0-SNAPSHOT+ or 3.6.-SNAPSHOT to make it a dynamic dependency (in addition to a changing dependency). But that doesn't work. I've also seen Peter N suggest using "latest.integration" but many of these core company libraries have multiple concurrent versions: 3.6.0-SNAPSHOT for the 3.6 line (against java7); 4.0.0-SNAPSHOT for the 4.x line (against java8). So we can't just always use the absolute latest we have to constrain that within a major/minor version: i.e. 3.6.-SNAPSHOT would be fine. |
Comment by Benjamin Muschko [ 15/Nov/16 ] |
As announced on the Gradle blog we are planning to completely migrate issues from JIRA to GitHub. We intend to prioritize issues that are actionable and impactful while working more closely with the community. Many of our JIRA issues are inactionable or irrelevant. We would like to request your help to ensure we can appropriately prioritize JIRA issues you’ve contributed to. Please confirm that you still advocate for your JIRA issue before December 10th, 2016 by:
We look forward to collaborating with you more closely on GitHub. Thank you for your contribution to Gradle! |
Comment by Benjamin Muschko [ 10/Feb/17 ] |
Thanks again for reporting this issue. We haven't heard back from you after our inquiry from November 15th. We are closing this issue now. Please create an issue on GitHub if you still feel passionate about getting it resolved. |