1

I have roughly something like his in build.gradle:

configurations.all {
    resolutionStrategy.cacheChangingModulesFor 0, 'minutes'
}

dependencies {
    compile 'com.company:common-lib:1.0-SNAPSHOT'
}

When executed locally with ./gradlew compileJava, new snapshot version of common-lib:1.0-SNAPSHOT is downloaded. However for some reason on the build server this is not happening. I'm not sure how to approach debugging this?

When running with --debug, the relevant output is:

Adding managed version in configuration 'compile' for dependency 'DefaultExternalModuleDependency{group='com.company', name='common-lib', version='1.0-SNAPSHOT', configuration='default'}'
Visiting dependency com.company:some-service:1.0(detachedConfiguration12) -> com.company:common-lib:1.0-SNAPSHOT(detachedConfiguration12)
Processing dependency 'com.company:common-lib:1.0-SNAPSHOT'
Preserving existing versions: {com.company:common-lib=1.0-SNAPSHOT, com.company:common-lib2=1.0-SNAPSHOT, com.company:common-lib2-service=1.0-SNAPSHOT}
Resolved versions: {com.company:common-lib=1.0-SNAPSHOT, com.company:common-lib2=1.0-SNAPSHOT, com.company:common-lib2-service=1.0-SNAPSHOT}
Found managed version '1.0-SNAPSHOT' for dependency 'com.company:common-lib' in dependency management for configuration 'compile'
Using version '1.0-SNAPSHOT' for dependency 'com.company:common-lib:1.0-SNAPSHOT'
Selecting new module version com.company:common-lib:1.0-SNAPSHOT
Attempting to resolve component for com.company:common-lib:1.0-SNAPSHOT using repositories [maven, BintrayJCenter]
Found cached version of changing module 'com.company:common-lib:1.0-SNAPSHOT' in 'maven'
Using cached module metadata for module 'com.company:common-lib:1.0-SNAPSHOT' in 'maven'
Using com.company:common-lib:1.0-SNAPSHOT from Maven repository 'maven'
Visiting configuration com.company:common-lib:1.0-SNAPSHOT(default).
Visiting dependency com.company:common-lib2:1.0-SNAPSHOT(default) -> com.company:common-lib:1.0-SNAPSHOT(compile,runtime)
Visiting dependency com.company:common-lib2-service:1.0-SNAPSHOT(default) -> com.company:common-lib:1.0-SNAPSHOT(compile,runtime)
Visiting configuration com.company:common-lib:1.0-SNAPSHOT(compile).
Visiting configuration com.company:common-lib:1.0-SNAPSHOT(master).
Visiting configuration com.company:common-lib:1.0-SNAPSHOT(runtime).
Visiting dependency com.company:common-lib2:1.0-SNAPSHOT(compile) -> com.company:common-lib:1.0-SNAPSHOT(compile,runtime)
Visiting dependency com.company:common-lib2:1.0-SNAPSHOT(runtime) -> com.company:common-lib:1.0-SNAPSHOT(compile,runtime)
Visiting configuration com.company:common-lib:1.0-SNAPSHOT(compile).
Changed edges for com.company:common-lib:1.0-SNAPSHOT(compile) selects same versions as previous traversal. ignoring
Visiting configuration com.company:common-lib:1.0-SNAPSHOT(master).
Changed edges for com.company:common-lib:1.0-SNAPSHOT(master) selects same versions as previous traversal. ignoring
Visiting configuration com.company:common-lib:1.0-SNAPSHOT(runtime).
Changed edges for com.company:common-lib:1.0-SNAPSHOT(runtime) selects same versions as previous traversal. ignoring
    com.company:common-lib
        com.company:common-lib
        com.company:common-lib
            com.company:common-lib
Visiting dependency com.company:some-service:1.0(detachedConfiguration13) -> com.company:common-lib:1.0-SNAPSHOT(detachedConfiguration13)
Selecting new module version com.company:common-lib:1.0-SNAPSHOT
Attempting to resolve component for com.company:common-lib:1.0-SNAPSHOT using repositories [maven, BintrayJCenter]
Using com.company:common-lib:1.0-SNAPSHOT from Maven repository 'maven'
Visiting configuration com.company:common-lib:1.0-SNAPSHOT(default).
com.company:common-lib:1.0-SNAPSHOT(default) has no transitive incoming edges. ignoring outgoing edges.
Found artifact 'common-lib.pom (com.company:common-lib:1.0-SNAPSHOT)' in resolver cache: ~/.gradle/caches/modules-2/files-2.1/com.company/common-lib/1.0-SNAPSHOT/31ff0a504a7238270426365f213a40d94eaadd3f/common-lib-1.0-SNAPSHOT.pom
    com.company:common-lib depends on:
        com.company:common-lib excludes:
    com.company:common-lib
        com.company:common-lib
        com.company:common-lib
            com.company:common-lib
    com.company:common-lib
Visiting dependency com.company:some-service:1.0(compile) -> com.company:common-lib:1.0-SNAPSHOT(compile)
Processing dependency 'com.company:common-lib:1.0-SNAPSHOT'
Found managed version '1.0-SNAPSHOT' for dependency 'com.company:common-lib' in dependency management for configuration 'compile'
Using version '1.0-SNAPSHOT' for dependency 'com.company:common-lib:1.0-SNAPSHOT'
Selecting new module version com.company:common-lib:1.0-SNAPSHOT
Attempting to resolve component for com.company:common-lib:1.0-SNAPSHOT using repositories [maven, BintrayJCenter]
Using com.company:common-lib:1.0-SNAPSHOT from Maven repository 'maven'
Visiting configuration com.company:common-lib:1.0-SNAPSHOT(default).
Visiting dependency com.company:common-lib2:1.0-SNAPSHOT(default) -> com.company:common-lib:1.0-SNAPSHOT(compile,runtime)
Visiting dependency com.company:common-lib2-service:1.0-SNAPSHOT(default) -> com.company:common-lib:1.0-SNAPSHOT(compile,runtime)
Visiting configuration com.company:common-lib:1.0-SNAPSHOT(compile).
Visiting configuration com.company:common-lib:1.0-SNAPSHOT(master).
Visiting configuration com.company:common-lib:1.0-SNAPSHOT(runtime).
Visiting dependency com.company:common-lib2:1.0-SNAPSHOT(compile) -> com.company:common-lib:1.0-SNAPSHOT(compile,runtime)
Visiting dependency com.company:common-lib2:1.0-SNAPSHOT(runtime) -> com.company:common-lib:1.0-SNAPSHOT(compile,runtime)
Visiting configuration com.company:common-lib:1.0-SNAPSHOT(compile).
Changed edges for com.company:common-lib:1.0-SNAPSHOT(compile) selects same versions as previous traversal. ignoring
Visiting configuration com.company:common-lib:1.0-SNAPSHOT(master).
Changed edges for com.company:common-lib:1.0-SNAPSHOT(master) selects same versions as previous traversal. ignoring
Visiting configuration com.company:common-lib:1.0-SNAPSHOT(runtime).
Changed edges for com.company:common-lib:1.0-SNAPSHOT(runtime) selects same versions as previous traversal. ignoring
Loading http://localhost:8081/artifactory/repository/com/company/common-lib/1.0-SNAPSHOT/common-lib-1.0-20160317.194817-12.jar
Constructing external resource: http://localhost:8081/artifactory/repository/com/company/common-lib/1.0-SNAPSHOT/common-lib-1.0-20160317.194817-12.jar
Constructing external resource metadata: http://localhost:8081/artifactory/repository/com/company/common-lib/1.0-SNAPSHOT/common-lib-1.0-20160317.194817-12.jar
Performing HTTP HEAD: http://localhost:8081/artifactory/repository/com/company/common-lib/1.0-SNAPSHOT/common-lib-1.0-20160317.194817-12.jar
Executing request HEAD /artifactory/repository/com/company/common-lib/1.0-SNAPSHOT/common-lib-1.0-20160317.194817-12.jar HTTP/1.1
Executing request HEAD /artifactory/repository/com/company/common-lib/1.0-SNAPSHOT/common-lib-1.0-20160317.194817-12.jar HTTP/1.1
Cached resource Thu Mar 17 19:48:17 UTC 2016 is up-to-date (lastModified: http://localhost:8081/artifactory/repository/com/company/common-lib/1.0-SNAPSHOT/common-lib-1.0-20160317.194817-12.jar).
Downloaded artifact 'common-lib.jar (com.company:common-lib:1.0-SNAPSHOT)' from resolver: maven

Note that the latest version of the snapshot is not common-lib-1.0-20160317.194817-12.jar but odoro-domain-1.0-20160323.120359-13.jar

What's my next step in trying to figure out why it's not downloading the latest snapshot?

Amir Abiri
  • 8,847
  • 11
  • 41
  • 57
  • I am no gradle expert, but from what you tell it sounds like you should force a cache refresh. Take a look here http://stackoverflow.com/questions/13565082/how-can-i-force-gradle-to-redownload-dependencies – faester Mar 24 '16 at 08:10
  • I don't want to force a cache refresh, this should happen automatically, as it happened on the developers' machines. Plus it has been more than 24 hours since the new snapshot was uploaded and still the snapshot is not updated. This is not the way it should work. – Amir Abiri Mar 24 '16 at 08:13
  • When you built locally you will typically but an artifact into the local cache which might explain why it works on the developer machine. Hope you find a solution. – faester Mar 24 '16 at 08:15

0 Answers0