Using a specific snapshot version of an artifact

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 http://server/nexus/content/repositories/repository/mygroup/1.0-SNAPSHOT/myartifact-1.0-20130523.094538-132.jar

Gradle tries to download the file from http://server/nexus/content/repositories/repository/mygroup/1.0-20130523.094538-132/myartifact-1.0-20130523.094538-132.jar

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 Like

Good question. So far I had thought that it’s done exactly as in your snippet above (except that the brackets are unnecessary). However, I can’t get it to work, and your explanation makes sense. I’m not aware of a specific configuration option for this, and can’t think of a good way to achieve this at all. (You could try to declare an Ivy repository with custom artifact pattern, but this approach will likely have limitations and/or problems.) I’ve raised GRADLE-2784 for this.

Is there a workaround for this?

I’m not aware of anything other than trying the Ivy repository option. Chances are that transitive dependency resolution won’t work then, though.

Last comment was 12 months ago, maybe there is an update, @Yannick were you able to find a workaround for this problem?, I got into the same issue.

I too could really use a solution to this issue