[GRADLE-2784] Using a specific snapshot version of an artifact Created: 29/May/13  Updated: 07/Mar/15  Resolved: 07/Mar/15

Status: Resolved
Project: Gradle
Affects Version/s: None
Fix Version/s: 2.4-rc-1

Type: Task
Reporter: Gradle Forums Assignee: Unassigned
Resolution: Fixed Votes: 14


 Description   

I'm trying to build my project with a specific version of a snapshot dependency.
The dependency is specified as
compile([group: 'mygroup', name: 'myartifact', version: '1.0-20130523.094538-132'])

In case of maven, this will fetch the artifact from
[1]http://server/nexus/content/repositor...

Gradle tries to download the file from
[2]http://server/nexus/content/repositor...

Obviously Gradle cannot find the artifact, as snapshot versions get stored in the 1.0-SNAPSHOT/ directory. How do I need to configure the maven plugin / my project in order to be able to use a specific version of a snapshot dependency?

Thanks in advance for any help
----------------------------------------------------------------------------------------
[1] http://server/nexus/content/repositories/repository/mygroup/1.0-SNAPSHOT/myartifact-1.0-20130523.094538-132.jar
[2] http://server/nexus/content/repositories/repository/mygroup/1.0-20130523.094538-132/myartifact-1.0-20130523.094538-132.jar



 Comments   
Comment by Ferzan Rizvi [ 13/Jan/14 ]

Has anyone figured out a workaround for this yet? I think this should be a necessary feature for build reproducibility and for deployments.

For example, we manage deployments through gradle and deploy to multiple environments. We want to deploy the same snapshot artifact set through all QA testing environments before releasing the build. In order to do that we have to depend on a specific snapshot version.

Comment by Jonathan Gamba [ 01/Aug/14 ]

I got into the same issue and I see this problem like a real bug, there is a reason of why this issue have not been addressed?, and repeating the question, has anyone figured out a workaround for this yet?.

Comment by Ferzan Rizvi [ 03/Aug/14 ]

You might want to try this out in Gradle 2.0 which is now released, I haven't tested if it has been fixed or not. I switched to using real versions and incrementing the version every build which aligns with Continuous Delivery since every artifact in Continuous Delivery is considered a release candidate.

Any versioning scheme not using the snapshot resolver should work though, like adding a timestamp to the artifact name <major>.<minor>.<build>-<timestamp>. If you have binary dependencies that you wish to always take the latest artifact (to mimic snapshot functionality), you can use the ivy resolve pattern for 'latest.release' or 'latest.version' in the dependency definition instead of the version number. This is bad practice though, in my opinion.

Hope that helps

Comment by Noam Y. Tenne [ 09/Feb/15 ]

I could really use a fix for this

Comment by Chris Beams [ 18/Feb/15 ]

I was just bitten by this as well. Would like to pin my app to a specific version of Spring Framework 4.2.0.BUILD-SNAPSHOT in order to avoid frequent downloads of new builds and to ensure build reproducibility. Any workaround suggestions would be appreciated.

Comment by Noam Y. Tenne [ 18/Feb/15 ]

I've opened a pull request

Generated at Wed Jun 30 12:31:25 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.