Unable to find existing SNAPSHOT dependency


(Gaurav Singh) #1

We are trying to build a SNAPSHOT of a project which is also a dependency to other projects. Objective it is get updated SNAPSHOTS of dependencies. After lot of attempts, still not able to get what we wanted.

When

version = 'SNAPSHOT'
 //publishes to Artifactory as ReferenceDataClient-SNAPSHOT.jar

configuration.all doesn’t fetches the new versions.

configurations.all {
    resolutionStrategy.cacheDynamicVersionsFor 10, 'minutes'
 }

When

version = 1234-SNAPSHOT
 //publishes to Artifactory as ReferenceDataClient-1234-20140115.213503-1.jar

dependency resolution is done as :

compile(group: ‘com.xxx’, name: ‘ReferenceDataClient’, version: ‘1234-SNAPSHOT’, changing : true)

Building throws exception as below :

Could not resolve all dependencies for configuration ':Flows-Core:compile'.
> Could not find com.xxx:ReferenceDataClient:1234-SNAPSHOT.
  Required by:
      com.xxx.flow:Flows-Core:1234-SNAPSHOT

Please let us know if SNAPSHOT configuration requires anymore setting.


(Bair) #2

I had this problem. What I did was configure the Artifactory repository to not give unique names to snapshot files. I’m not sure how to solve the problem with unique snapshot file names (probably if I were using the maven POMs on the artifactory server correctly this would work right, but I’m not).


(Gaurav Singh) #3

I also had the problem of update too. Does it gets the new SNAPSHOT after that change ?


(Bair) #4

I don’t know, I haven’t tried doing an update to one of my SNAPSHOT files in artifactory yet. It should though, as gradle checks the checksum if I remember correctly. Also you can force gradle to redownload dependencies in the worst case.


(Peter Niederwieser) #5

Publishing and consuming snapshots doesn’t require any special settings. The fact that the published version contains a timestamp is expected, and the consumer doesn’t have to care. By default, consumers wiill check for new snapshots every 24 hours. To reduce this timespan, you can either run with ‘–refresh-dependencies’, or configure ‘resolutionStrategy.cacheChangingVersionsFor’ (not ‘cacheDynamicVersionsFor’).


#6

Are you using a ‘maven’ or ‘ivy’ repository format? Special handling of SNAPSHOT versions is only available for ‘maven’ repositories.


(Sebastien Tardif) #7

It seems that without pom.xml published, the support for -SNAPSHOT is not working.


(Peter Niederwieser) #8

That’s easily possible. If ‘pom.xml’ or ‘maven-metadata.xml’ is missing, you can’t expect much. Both of these files are generated and published automatically by Maven and Gradle.